Home > Codi > Menu_Veure_Veins_2.m

Menu_Veure_Veins_2

PURPOSE ^

Aquesta pantalla mostra la informacio dels veins mes propers que s'han

SYNOPSIS ^

function varargout = Menu_Veure_Veins_2(varargin)

DESCRIPTION ^

Aquesta pantalla mostra la informacio dels veins mes propers que s'han
recuperat de la base de casos per a un seguit d'observacions. Aquesta
pantalla necesita com a entrada un o diversos CBR i els respectius casos
de test. 

Aquesta pantalla creara les variables temporals (var_temp_Test,
var_temp_CBR i temp_aux) no poden ser eliminades mentre la pantalla
estigui oberta ja que provocaria errors greus.

Aquesta pantalla s'invoca generalment des d'altres pantalles per fer-ho
manualment cal indicar els parametres correctament. Primer un cell que
contingui els CBR i a continuaciķ un list amb els objectes DATA (casos de
test) corresponents en cada cas.

 Menu_Veure_Veins_2({CBR},[DATA]);

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function varargout = Menu_Veure_Veins_2(varargin)
0002 %Aquesta pantalla mostra la informacio dels veins mes propers que s'han
0003 %recuperat de la base de casos per a un seguit d'observacions. Aquesta
0004 %pantalla necesita com a entrada un o diversos CBR i els respectius casos
0005 %de test.
0006 %
0007 %Aquesta pantalla creara les variables temporals (var_temp_Test,
0008 %var_temp_CBR i temp_aux) no poden ser eliminades mentre la pantalla
0009 %estigui oberta ja que provocaria errors greus.
0010 %
0011 %Aquesta pantalla s'invoca generalment des d'altres pantalles per fer-ho
0012 %manualment cal indicar els parametres correctament. Primer un cell que
0013 %contingui els CBR i a continuaciķ un list amb els objectes DATA (casos de
0014 %test) corresponents en cada cas.
0015 %
0016 % Menu_Veure_Veins_2({CBR},[DATA]);
0017 %
0018 %
0019 
0020 %Autogenerat - inicialitza tots els callbacks i parametres de la finesta
0021 gui_Singleton = 1;
0022 gui_State = struct('gui_Name',       mfilename, ...
0023                    'gui_Singleton',  gui_Singleton, ...
0024                    'gui_OpeningFcn', @Menu_Veure_Veins_2_OpeningFcn, ...
0025                    'gui_OutputFcn',  @Menu_Veure_Veins_2_OutputFcn, ...
0026                    'gui_LayoutFcn',  [] , ...
0027                    'gui_Callback',   []);
0028 if nargin && ischar(varargin{1})
0029     gui_State.gui_Callback = str2func(varargin{1});
0030 end
0031 
0032 if nargout
0033     [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
0034 else
0035     gui_mainfcn(gui_State, varargin{:});
0036 end
0037 
0038 
0039 function Menu_Veure_Veins_2_OpeningFcn(hObject, ~, handles, varargin)
0040 %funciķ que s'invoca en crear la finestra a varargin ens arriven els
0041 % parametres extres en el nostre cas els CBR i DATA.
0042 
0043 handles.output = hObject;
0044 handles=menu(handles);
0045 
0046 
0047 guidata(hObject, handles);
0048 
0049 %busquem objectes CBR
0050 if nargin < 5
0051     errordlg('We needparameters to open this window!','Error');
0052 
0053 else
0054     
0055     x=varargin{1}{1};
0056     x=whos('x');
0057     list=[];
0058     if strcmp(x.class,'CBR') ~= 0 %es
0059          x=varargin{1};
0060           x=whos('x');
0061         for i=1:x.size(2)
0062             list=[list; {['Division ' num2str(i)]}];
0063         end
0064     end
0065     if isempty(list)
0066         list={'No CBR selected'};
0067     end
0068 %    evalin('base','var_temp_CBR');
0069      assignin('base','var_temp_CBR', varargin{1});
0070     
0071 %    evalin('base','var_temp_Test');
0072      assignin('base','var_temp_Test', varargin{2});
0073     
0074     set(handles.popupmenu1,'String',list);
0075     set(handles.uipanel2,'Visible','off');
0076     set(handles.uipanel4,'Visible','off');
0077     set(handles.uipanel8,'Visible','off');
0078     set(handles.pushbutton3,'Visible','off')
0079     
0080     %mirem si ens han passat un 3er parametre (venim de menu_CBR)
0081     if length(varargin) >= 3
0082          
0083         set(handles.popupmenu1,'String',{varargin{3}});
0084         set(handles.text1,'String','CBR variable name:')
0085         set(handles.popupmenu3,'String', {'Initial Test';'Other Tests'})
0086                 
0087     end
0088 end
0089 
0090 function popupmenu1_Callback(hObject, ~, handles)
0091 
0092 %recuperem el CBR
0093 mcbr=get(handles.popupmenu1,'Value');% numero de particiķ (CBR i test si cal)
0094 
0095 if get(handles.popupmenu3,'Value') == 1
0096     %Vol utilitzar la particio mcbr i el test mcbr
0097     
0098     %set(handles.listbox1,'String',evalin('base',['var_temp_Test(' num2str(mcbr) ').getBatchLabel();']));
0099     nom = ['var_temp_Test(' num2str(mcbr) ')'];
0100     %actualitzem la llista dels lots
0101     aux=evalin('base',[nom '.getBatchLabel()']);
0102     
0103     %si no te noms de lot els generem asignant-hi la posicio actual del lot!!
0104     if(isempty(aux) && (evalin('base',[nom '.getBatchCount()']) > 0))
0105         evalin('base',[nom '.setBatchLabel(num2cell(1:' nom '.getBatchCount))']);
0106         warndlg('Selected object had no batch names. Automatic ones ware assigned.','Attention!')
0107 
0108         aux=evalin('base',[nom '.getBatchLabel()']);
0109     end
0110     set(handles.listbox1,'String',aux);
0111     set(handles.listbox1,'Value',1);
0112     
0113     set(handles.listbox1,'Value',1);
0114     
0115     set(handles.listbox2,'String',{});
0116     set(handles.listbox2,'Value',1);
0117     
0118     set(handles.uipanel2,'Visible','off');
0119     
0120 else
0121      %Vol utilitzar la particio mcbr i el test indicat al popupmenu4
0122     
0123      set(handles.uipanel2,'Visible','on');
0124     %busquem objectes de tipus DATA
0125     x=evalin('base','whos();');
0126     list=[];
0127     for i=1:length(x)
0128         if strcmp(x(i).class,'DATA') ~=0
0129             if not( strcmp(x(i).name,'var_temp_Test') || strcmp(x(i).name,'var_aux')) 
0130                 list=[list; {x(i).name}];
0131             end
0132         end
0133     end
0134     if isempty(list)
0135         list={'No DATA objects in workspace'};
0136     end
0137     set(handles.popupmenu4,'String',list);
0138     if (get(handles.popupmenu4,'Value') > length(list))
0139         set(handles.popupmenu4,'Value',1); 
0140     end
0141      
0142      
0143      
0144     set(handles.listbox2,'String',{});
0145     set(handles.listbox2,'Value',1);
0146     
0147     variable=get(handles.popupmenu4,'String');
0148     nom=variable{get(handles.popupmenu4,'Value')};
0149     
0150     
0151     if isempty(strfind(nom,'No DATA objects in workspace'))
0152 
0153         %actualitzem la llista dels lots
0154         aux=evalin('base',[nom '.getBatchLabel()']);
0155 
0156         %si no te noms de lot els generem asignant-hi la posicio actual del lot!!
0157         if(isempty(aux) && (evalin('base',[nom '.getBatchCount()']) > 0))
0158             evalin('base',[nom '.setBatchLabel(num2cell(1:' nom '.getBatchCount))']);
0159             warndlg('Selected object had no batch names. Automatic ones ware assigned.','Attention!')
0160             aux=evalin('base',[nom '.getBatchLabel()']);
0161         end
0162         set(handles.listbox1,'String',aux);
0163         set(handles.listbox1,'Value',1);
0164     else
0165         set(handles.listbox1,'String',{});
0166         set(handles.listbox1,'Value',1);
0167     end
0168    
0169 end
0170 
0171 set(handles.uipanel4,'Visible','on');
0172 set(handles.uipanel8,'Visible','on');
0173 
0174 set(handles.text5,'String',[ '[ ' num2str(evalin('base',['var_temp_CBR{' num2str(mcbr) '}.getVK();'])) ' ]']);
0175 dcs={
0176 'Distance using Scores'
0177 'Distance using T^2'
0178 'Distance using Q'
0179 'Distance using a combination of Q and T^2'
0180 'Distance using a combination of Q and Scores'
0181 'Distance using a combination of T^2 and Scores'
0182 'Distance using Q Contributions with Euclidean distance'
0183 'Distance using T^2 Contributions with Euclidean distance'
0184 'Distance using Q Contributions with Mahalanobis (STD)'
0185 'Distance using T^2 Contributions with Mahalanobis (STD)'
0186 'Bi-dimencional distance using Q and T^2 '
0187 'Distance using Q Signatures'
0188 'Distance using T^2 Signatures'
0189 'Distance using Q Signatures with phase agroupations'
0190 'Distance using T^2 Signatures with phase agroupations'
0191 'Distance using Scores (without normalization)'
0192 'Distance using Q Signatures with binary phase agroupations'
0193 'Distance using T^2 Signatures with binary phase agroupations'
0194 };
0195 aux1 = evalin('base',['var_temp_CBR{' num2str(mcbr) '}.getDC();']);
0196 aux=dcs{aux1};
0197 
0198 if aux1 == 17 || aux1==18
0199     aux= [aux ' param: ' num2str(evalin('base',['var_temp_CBR{' num2str(mcbr) '}.getParam();']))];
0200 end
0201 set(handles.text6,'String', aux );
0202 
0203 mets={
0204 'Weighted voting with Similitude ratio and class frequency'
0205 'Simple voting'
0206 'Weighted voting with Similitude ratio'
0207 };
0208 set(handles.text17,'String', mets{evalin('base',['var_temp_CBR{' num2str(mcbr) '}.getMethod();'])} );
0209 
0210 %plot
0211 axes(handles.axes1);
0212 cla;
0213 if isfield(handles, 'plot')
0214 handles=rmfield(handles,'plot');
0215 end
0216 handles.plot.C_B=evalin('base',['var_temp_CBR{' num2str(mcbr) '}.getCaseBase.plotT2Q(''.'');']);
0217 handles.plot.Mod=evalin('base',['var_temp_CBR{' num2str(mcbr) '}.getModel.plotT2Q(''O'',[],''no'');']);
0218 
0219 %[dades class nom]=evalin('base',['var_temp_Test(' num2str(mcbr) ').getBatch(' num2str(get(handles.listbox1,'Value')) ');']);
0220 
0221 evalin('base',['temp_aux=var_temp_Test(' num2str(mcbr) ').copy;']);
0222 evalin('base',['temp_aux.deleteBatch([1:' num2str(get(handles.listbox1,'Value')-1) ' ' num2str(get(handles.listbox1,'Value')+1) ':temp_aux.getBatchCount]); ']);
0223 
0224 proj=evalin('base',['var_temp_CBR{' num2str(mcbr) '}.getModel.project( temp_aux );']);
0225 handles.plot.X=proj.plotT2Q('X','K','no');
0226 evalin('base','clear temp_aux');
0227 
0228 ins='';
0229 for i = 1:length(evalin('base',['unique(var_temp_CBR{' num2str(mcbr) '}.getCaseBase.getClass);'])) %per cada classe
0230     ins=strcat(ins,['  ''clase ' num2str(i) ' - Base Casos'' '] );
0231     if i ~= length(evalin('base',['unique(var_temp_CBR{' num2str(mcbr) '}.getCaseBase.getClass);']))
0232         ins=strcat(ins,',');
0233     end
0234 end
0235 eval(['legend(' ins ',''Q Limit'',''T^2 Limit'',''Model Elements'', ''Selected Test Case'',''Location'',[0 0 100 100]);'])
0236 %legend('clase 1 - Base Casos','clase 2 - Base Casos', 'clase 3 - Base Casos','Limit de Q','Limit de T^2','Elements del Model','Limit de Q','Limit de T^2', 'Cas de Test seleccionat','Vei seleccionat')
0237 set(handles.popupmenu5,'Value',1)
0238 guidata(hObject, handles);
0239 
0240 function pushbutton1_Callback(~, ~, ~)
0241 Menu_Load_Dades();
0242 
0243 function popupmenu3_Callback(hObject, eventdata, handles)
0244  popupmenu1_Callback(hObject, eventdata, handles)%es on fa tot
0245 function popupmenu4_Callback(hObject, eventdata, handles)
0246 popupmenu1_Callback(hObject, eventdata, handles)%es on fa tot
0247 
0248 function pushbutton2_Callback(~, ~, handles)
0249 nom = genvarname( get(handles.edit7,'String'));
0250 mcbr=get(handles.popupmenu1,'Value');% numero de particiķ CBR
0251 evalin('base',[nom '= var_temp_CBR{' num2str(mcbr) '};'])
0252 Update_Caller
0253 
0254 function listbox1_Callback(hObject, ~, handles)
0255 %recuperem el CBR
0256 mcbr=get(handles.popupmenu1,'Value');
0257 mcbr=['var_temp_CBR{' num2str(mcbr) '}'];%el CBR
0258 
0259 %recuperem les dades
0260 if get(handles.popupmenu3,'Value') == 1
0261     %es el del Cross validation
0262     mdades=get(handles.popupmenu1,'Value');
0263     mdades=['var_temp_Test(' num2str(mdades) ')'];%DATA
0264 else
0265     %el que ens hagin indicat
0266     variable=get(handles.popupmenu4,'String');
0267     mdades=variable{get(handles.popupmenu4,'Value')};
0268     
0269 end
0270 
0271 if ~isempty(get(handles.listbox1,'String'))
0272     %han seleccionat un lot i existeix per tant el recuperem per fer els
0273     %plots corresponents
0274     
0275     [dad,clase,ref]=evalin('base',[ mdades '.getBatch(' num2str(get(handles.listbox1,'value')) ');' ]);
0276     aux=evalin('base',[mdades '.copy();']);
0277     
0278     %Els parametres del CBr estan inicialitzats segur - venim de fer un Cross
0279     
0280     aux.deleteBatch(1:aux.getBatchCount());
0281     aux.addBatch(dad,clase,ref);
0282     %global var_temp_CBR;
0283     assignin('base', 'temp_aux',aux);
0284     [vei, Test_set ]=evalin('base',[mcbr '.retrieve( temp_aux )']);
0285     [dades , class, noms] = evalin('base',[mcbr '.getCase( [' num2str(vei') '] )']);
0286     
0287     set(handles.listbox2,'String',noms);
0288     set(handles.listbox2,'Value',1);
0289     
0290     set(handles.edit3,'String', Test_set.getClass());
0291     set(handles.edit2,'String', Test_set.getQ());
0292     set(handles.edit1,'String', Test_set.getT2());
0293     
0294     aux=Test_set.getP();
0295     aux=aux(get(handles.listbox1,'Value'),:);
0296     aux=char2cell(num2str(aux))';
0297     
0298     set(handles.listbox3,'String', aux);
0299     set(handles.listbox3,'Value',1);
0300     
0301     %Actualitzem el plot
0302     mcb = get(handles.popupmenu1,'Value');
0303     if get(handles.popupmenu5,'Value') == 1
0304         if(isfield(handles,'plot'))
0305             %Com que tenim els handles del plot podem eliminar nomes el que
0306             %calgui!
0307             hold on
0308             
0309             %eliminem la part del plot que canvia!
0310             delete(handles.plot.X(handles.plot.X~=0));
0311             handles.plot=rmfield(handles.plot,'X');
0312           
0313             if(isfield(handles.plot,'O'))
0314                 delete(handles.plot.O(handles.plot.O~=0));
0315                 handles.plot=rmfield(handles.plot,'O');
0316             end
0317             
0318             %recuperem l'element seleccionat i el projectem!
0319             evalin('base',['temp_aux=' mdades '.copy;']);
0320             evalin('base',['temp_aux.deleteBatch([1:' num2str(get(handles.listbox1,'Value')-1) ' ' num2str(get(handles.listbox1,'Value')+1) ':temp_aux.getBatchCount]); ']);
0321             proj=evalin('base',['var_temp_CBR{' num2str(mcb) '}.getModel.project( temp_aux );']);
0322             
0323             %fem el plot corresponent per mostrar-lo a l'usuari!
0324             handles.plot.X=proj.plotT2Q('X','K','no');
0325             hold off
0326             evalin('base','clear temp_aux');
0327         else
0328             %no podem fer la optimitzaciķ perque no tenim els handles!
0329             
0330             axes(handles.axes1);
0331             cla;
0332             if isfield(handles, 'plot')
0333                 handles=rmfield(handles,'plot');
0334             end
0335             axis auto;
0336             hold on
0337             %Cas de test selecccionat
0338             
0339             handles.plot.C_B=evalin('base',['var_temp_CBR{' num2str(mcb) '}.getCaseBase.plotT2Q(''.'');']);
0340             handles.plot.Mod=evalin('base',['var_temp_CBR{' num2str(mcb) '}.getModel.plotT2Q(''O'',[],''no'');']);
0341             
0342             %[dades class nom]=evalin('base',['var_temp_Test(' num2str(mcbr) ').getBatch(' num2str(get(handles.listbox1,'Value')) ');']);
0343             
0344             % evalin('base',['temp_aux=var_temp_Test(' num2str(mcb) ').copy;']);
0345             evalin('base',['temp_aux=' mdades '.copy;']);
0346             evalin('base',['temp_aux.deleteBatch([1:' num2str(get(handles.listbox1,'Value')-1) ' ' num2str(get(handles.listbox1,'Value')+1) ':temp_aux.getBatchCount]); ']);
0347             
0348             proj=evalin('base',['var_temp_CBR{' num2str(mcb) '}.getModel.project( temp_aux );']);
0349            handles.plot.X= proj.plotT2Q('X','K','no');
0350             hold off
0351             evalin('base','clear temp_aux');
0352             
0353         end
0354     end
0355     %dades i plot lot vei!
0356     [dad,clase,ref]=evalin('base',[ mdades '.getBatch(' num2str(get(handles.listbox1,'value')) ');' ]);
0357     aux=evalin('base',[mdades '.copy();']);
0358     
0359     %VK i DC estan inicialitzats venim de fer un cross
0360     
0361     aux.deleteBatch(1:aux.getBatchCount());
0362     aux.addBatch(dad,clase,ref);
0363     
0364     %[dades , ~, class noms]=eval([mcbr '.retrieve( aux  )']);
0365     %[dades , class, noms] = eval([mcbr '.getCase( ' vei ' )']);
0366     aux.deleteBatch(1:aux.getBatchCount());
0367     sel=get(handles.listbox2,'Value');
0368     if not(isempty(sel))
0369         
0370         aux.addBatch(dades(:,:,sel),class(sel),noms(sel));
0371             assignin('base', 'temp_aux',aux);
0372         [~, Test_set ]=evalin('base',[mcbr '.retrieve( temp_aux )']);
0373         
0374         set(handles.edit6,'String', Test_set.getClass());
0375         set(handles.edit5,'String', Test_set.getQ());
0376         set(handles.edit4,'String', Test_set.getT2());
0377         
0378         aux=Test_set.getT();
0379         %  aux=aux(get(handles.listbox2,'Value'),:);
0380         aux=char2cell(num2str(aux))';
0381         
0382         set(handles.listbox4,'String', aux);
0383         set(handles.listbox4,'Value',1);
0384         if get(handles.popupmenu5,'Value') == 1
0385             %plots %veins
0386             hold on
0387             handles.plot.O=Test_set.plotT2Q('O','K','no');
0388             hold off
0389         end
0390     end
0391     
0392     switch get(handles.popupmenu5,'Value')
0393         case 1
0394             ins='';
0395             for i = 1:length(evalin('base',['unique(var_temp_CBR{' num2str(mcb) '}.getCaseBase.getClass);'])) %per cada classe
0396                 ins=strcat(ins,['  ''clase ' num2str(i) ' - Base Casos'' '] );
0397                 if i ~= length(evalin('base',['unique(var_temp_CBR{' num2str(mcb) '}.getCaseBase.getClass);']))
0398                     ins=strcat(ins,',');
0399                 end
0400             end
0401             eval(['legend(' ins ',''Q Limit'',''T^2 Limit'',''Model Elements'', ''Selected Test Case'',''Selected Neighbour'',''Location'',[0.15 0.1 0.01 0.01 ]);'])
0402         case 2
0403             axes(handles.axes1);
0404             cla;
0405             if isfield(handles, 'plot')
0406                 handles=rmfield(handles,'plot');
0407             end
0408             axis auto;
0409             a=evalin('base',['var_temp_CBR{' num2str(mcb) '}.getCaseBase.copy']);
0410             a.deleteBatch(1:a.getBatchCount)
0411             a.addBatch(dad,clase,ref)
0412             a.addBatch(dades(:,:,get(handles.listbox2,'value')),class(get(handles.listbox2,'value')),noms(get(handles.listbox2,'value')))
0413             a.plotQContribution(:)
0414             legend('Test Batch','Neighbour Batch','Q Contribution Limit','Location',[0.15 0.1 0.01 0.01 ]);
0415         case 3
0416             axes(handles.axes1);
0417             cla;
0418             if isfield(handles, 'plot')
0419                 handles=rmfield(handles,'plot');
0420             end
0421             axis auto;
0422             a=evalin('base',['var_temp_CBR{' num2str(mcb) '}.getCaseBase.copy']);
0423             a.deleteBatch(1:a.getBatchCount)
0424             a.addBatch(dad,clase,ref)
0425             a.addBatch(dades(:,:,get(handles.listbox2,'value')),class(get(handles.listbox2,'value')),noms(get(handles.listbox2,'value')))
0426             a.plotT2Contribution(:)
0427             legend('Test Batch','Neighbour Batch','T^2 Contribution Limit','Location',[0.15 0.1 0.01 0.01 ]);
0428         otherwise
0429     end
0430 end
0431 guidata(hObject, handles);
0432 
0433 function listbox2_Callback(hObject, ~, handles)
0434 %recuperem les dades
0435 if get(handles.popupmenu3,'Value') == 1
0436     %es el del Cross validation
0437     mdades=get(handles.popupmenu1,'Value');
0438     mdades=['var_temp_Test(' num2str(mdades) ')'];%DATA
0439 else
0440     %el que ens hagin indicat
0441     variable=get(handles.popupmenu4,'String');
0442     mdades=variable{get(handles.popupmenu4,'Value')};
0443     
0444 end
0445 
0446 if ~isempty(get(handles.listbox1,'String'))
0447     
0448     %Actualitzem el plot
0449     mcb = get(handles.popupmenu1,'Value');
0450     if get(handles.popupmenu5,'Value') == 1
0451         %recuperem el CBR
0452         if(isfield(handles,'plot'))
0453             %Com que tenim els handles del plot podem eliminar nomes el que
0454             %calgui!
0455             hold on
0456             
0457             %eliminem la part del plot que canvia!
0458             delete(handles.plot.X((handles.plot.X~=0)));
0459             handles.plot=rmfield(handles.plot,'X');
0460             if(isfield(handles.plot,'O'))
0461                 delete(handles.plot.O(handles.plot.O~=0));
0462                 handles.plot=rmfield(handles.plot,'O');
0463             end
0464             
0465             evalin('base',['temp_aux=' mdades '.copy;']);
0466             evalin('base',['temp_aux.deleteBatch([1:' num2str(get(handles.listbox1,'Value')-1) ' ' num2str(get(handles.listbox1,'Value')+1) ':temp_aux.getBatchCount]); ']);
0467             
0468             proj=evalin('base',['var_temp_CBR{' num2str(mcb) '}.getModel.project( temp_aux );']);
0469             handles.plot.X=proj.plotT2Q('X','K','no');
0470             hold off
0471             evalin('base','clear temp_aux');
0472             
0473         else
0474             
0475             
0476             axes(handles.axes1);
0477             cla;
0478             if isfield(handles, 'plot') 
0479                 handles=rmfield(handles,'plot');
0480             end
0481             axis auto;
0482             hold on
0483             %Cas de test selecccionat
0484             
0485             handles.plot.C_B=evalin('base',['var_temp_CBR{' num2str(mcb) '}.getCaseBase.plotT2Q(''.'');']);
0486             handles.plot.Mod=evalin('base',['var_temp_CBR{' num2str(mcb) '}.getModel.plotT2Q(''O'',[],''no'');']);
0487             
0488             %[dades class nom]=evalin('base',['var_temp_Test(' num2str(mcbr) ').getBatch(' num2str(get(handles.listbox1,'Value')) ');']);
0489             
0490             % evalin('base',['temp_aux=var_temp_Test(' num2str(mcb) ').copy;']);
0491             evalin('base',['temp_aux=' mdades '.copy;']);
0492             evalin('base',['temp_aux.deleteBatch([1:' num2str(get(handles.listbox1,'Value')-1) ' ' num2str(get(handles.listbox1,'Value')+1) ':temp_aux.getBatchCount]); ']);
0493             
0494             proj=evalin('base',['var_temp_CBR{' num2str(mcb) '}.getModel.project( temp_aux );']);
0495             handles.plot.X=proj.plotT2Q('X','K','no');
0496             hold off
0497             evalin('base','clear temp_aux');
0498         end
0499     end
0500     mcbr=get(handles.popupmenu1,'Value');
0501     mcbr=['var_temp_CBR{' num2str(mcbr) '}'];%el CBR
0502     
0503     
0504     [dad,clase,ref]=evalin('base',[ mdades '.getBatch(' num2str(get(handles.listbox1,'value')) ');' ]);
0505     aux=evalin('base',[mdades '.copy();']);
0506     
0507     %VK i DC estan inicialitzats venim de fer un cross
0508     
0509     aux.deleteBatch(1:aux.getBatchCount());
0510     aux.addBatch(dad,clase,ref);
0511     %global  var_temp_CBR;
0512     %[vei , ~, class noms]=eval([mcbr '.retrieve( aux  )']);
0513         assignin('base', 'temp_aux',aux);
0514     [vei, ~ ]=evalin('base',[mcbr '.retrieve( temp_aux  )']);
0515     [dades , class, noms] = evalin('base',[mcbr '.getCase( [' num2str(vei') '] )']);
0516     
0517     aux.deleteBatch(1:aux.getBatchCount());
0518     sel=get(handles.listbox2,'Value');
0519     if not(isempty(sel))
0520         
0521         aux.addBatch(dades(:,:,sel),class(sel),noms(sel));
0522         [~, Test_set ]=evalin('base',[mcbr '.retrieve( temp_aux )']);
0523         
0524         set(handles.edit6,'String', Test_set.getClass());
0525         set(handles.edit5,'String', Test_set.getQ());
0526         set(handles.edit4,'String', Test_set.getT2());
0527         
0528         aux=Test_set.getT();
0529         % aux=aux(get(handles.listbox2,'Value'),:);
0530         aux=char2cell(num2str(aux))';
0531         
0532         set(handles.listbox4,'String', aux);
0533         set(handles.listbox4,'Value',1);
0534         if get(handles.popupmenu5,'Value') == 1
0535             %plot vei selec
0536             hold on
0537             handles.plot.O=Test_set.plotT2Q('O','K','no');
0538             hold off
0539         end
0540         
0541     end
0542     
0543     switch get(handles.popupmenu5,'Value')
0544         case 1
0545             ins='';
0546             for i = 1:length(evalin('base',['unique(var_temp_CBR{' num2str(mcb) '}.getCaseBase.getClass);'])) %per cada classe
0547                 ins=strcat(ins,['  ''clase ' num2str(i) ' - Base Casos'' '] );
0548                 if i ~= length(evalin('base',['unique(var_temp_CBR{' num2str(mcb) '}.getCaseBase.getClass);']))
0549                     ins=strcat(ins,',');
0550                 end
0551             end
0552             eval(['legend(' ins ',''Q Limit'',''T^2 Limit'',''Model Elements'', ''Selected Test Case'',''Selected Neighbour'',''Location'', [0.15 0.1 0.01 0.01 ] );'])
0553         case 2
0554             axes(handles.axes1);
0555             cla;
0556             if isfield(handles, 'plot')
0557                 handles=rmfield(handles,'plot');
0558             end
0559             axis auto;
0560             a=evalin('base',['var_temp_CBR{' num2str(mcb) '}.getCaseBase.copy']);
0561             a.deleteBatch(1:a.getBatchCount)
0562             a.addBatch(dad,clase,ref)
0563             a.addBatch(dades(:,:,get(handles.listbox2,'value')),class(get(handles.listbox2,'value')),noms(get(handles.listbox2,'value')))
0564             a.plotQContribution(:)
0565             legend('Test Batch','Neighbour Batch','Q Contribution Limit','Location',[0.15 0.1 0.01 0.01 ]);
0566         case 3
0567             axes(handles.axes1);
0568             cla;
0569             if isfield(handles, 'plot')
0570                 handles=rmfield(handles,'plot');
0571             end
0572             axis auto;
0573             a=evalin('base',['var_temp_CBR{' num2str(mcb) '}.getCaseBase.copy']);
0574             a.deleteBatch(1:a.getBatchCount)
0575             a.addBatch(dad,clase,ref)
0576             a.addBatch(dades(:,:,get(handles.listbox2,'value')),class(get(handles.listbox2,'value')),noms(get(handles.listbox2,'value')))
0577             a.plotT2Contribution(:)
0578             legend('Test Batch','Neighbour Batch','T^2 Contribution Limit','Location',[0.15 0.1 0.01 0.01 ]);
0579         otherwise
0580     end
0581 end
0582 guidata(hObject, handles);
0583 
0584 function listbox1_CreateFcn(hObject, ~, ~)
0585 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0586     set(hObject,'BackgroundColor','white');
0587 end
0588 function listbox2_CreateFcn(hObject, ~, ~)
0589 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0590     set(hObject,'BackgroundColor','white');
0591 end
0592 
0593 function Update(hObject, ~, handles) 
0594 handles.output = hObject;
0595 handles=menu(handles);
0596 %actualitzar llistes ??
0597 guidata(hObject, handles);
0598 
0599 %% inutils
0600 function listbox3_Callback(~, ~, ~)
0601 function listbox3_CreateFcn(hObject, ~, ~)
0602 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0603     set(hObject,'BackgroundColor','white');
0604 end
0605 function listbox4_Callback(~, ~, ~)
0606 function listbox4_CreateFcn(hObject, ~, ~)
0607 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0608     set(hObject,'BackgroundColor','white');
0609 end
0610 function popupmenu1_CreateFcn(hObject, ~, ~)
0611 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0612     set(hObject,'BackgroundColor','white');
0613 end
0614 function popupmenu3_CreateFcn(hObject, ~, ~)
0615 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0616     set(hObject,'BackgroundColor','white');
0617 end
0618 function popupmenu4_CreateFcn(hObject, ~, ~)
0619 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0620     set(hObject,'BackgroundColor','white');
0621 end
0622 function edit1_Callback(~, ~, ~)
0623 function edit1_CreateFcn(hObject, ~,~)
0624 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0625     set(hObject,'BackgroundColor','white');
0626 end
0627 function edit2_Callback(~, ~, ~)
0628 function edit2_CreateFcn(hObject, ~, ~)
0629 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0630     set(hObject,'BackgroundColor','white');
0631 end
0632 function edit3_Callback(~, ~, ~)
0633 function edit3_CreateFcn(hObject, ~, ~)
0634 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0635     set(hObject,'BackgroundColor','white');
0636 end
0637 function edit4_Callback(~, ~, ~)
0638 function edit4_CreateFcn(hObject, ~, ~)
0639 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0640     set(hObject,'BackgroundColor','white');
0641 end
0642 function edit5_Callback(~, ~, ~)
0643 function edit5_CreateFcn(hObject, ~, ~)
0644 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0645     set(hObject,'BackgroundColor','white');
0646 end
0647 function edit6_Callback(~, ~, ~)
0648 function edit6_CreateFcn(hObject, ~, ~)
0649 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0650     set(hObject,'BackgroundColor','white');
0651 end
0652 function edit7_Callback(~, ~, ~)
0653 function edit7_CreateFcn(hObject, ~, ~)
0654 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0655     set(hObject,'BackgroundColor','white');
0656 end
0657 function varargout = Menu_Veure_Veins_2_OutputFcn(~, ~, handles) 
0658 varargout{1} = handles.output;
0659 
0660 
0661 function figure1_CloseRequestFcn(hObject, ~, ~)
0662 evalin('base','clear var_temp_CBR;')
0663 evalin('base','clear var_temp_Test;')
0664 evalin('base','clear temp_aux;')
0665 delete(hObject);
0666 
0667 
0668 function popupmenu5_Callback(hObject, eventdata, handles)
0669 if(get(handles.popupmenu5,'Value')==2 || get(handles.popupmenu5,'Value')==3 )
0670     set(handles.pushbutton3,'Visible','on')
0671 else
0672     set(handles.pushbutton3,'Visible','off')
0673 end
0674 
0675 if(get(handles.popupmenu5,'Value')==4) % Signatures Q
0676     %recuperem les dades
0677     if get(handles.popupmenu3,'Value') == 1
0678         axes(handles.axes1);
0679         cla;
0680         if isfield(handles, 'plot')
0681             handles=rmfield(handles,'plot');
0682         end
0683         hold on
0684         %es el del Cross validation
0685         mdades=get(handles.popupmenu1,'Value');
0686         mdades=['var_temp_CBR{' num2str(mdades) '}.getCaseBase.plotQSignatures();'];%DATA
0687         evalin('base',mdades);
0688         legend(get(legend,'String'),'Location',[0.15 0.1 0.01 0.01 ]);
0689         hold off
0690     else
0691         axes(handles.axes1);
0692         cla;
0693         if isfield(handles, 'plot')
0694             handles=rmfield(handles,'plot');
0695         end
0696         hold on
0697         %el que ens hagin indicat
0698         variable=get(handles.popupmenu1,'String');
0699         
0700                
0701         mdades=variable{get(handles.popupmenu1,'Value')};
0702         
0703         if strcmp(mdades(1:min(end,9)), 'Division ')
0704             mdades = ['temp_CBR{' mdades(10:end) '}'];
0705         end
0706         mdades=[ mdades '.getCaseBase.plotQSignatures();'];%DATA
0707         evalin('base',mdades);        
0708         legend(get(legend,'String'),'Location',[0.15 0.1 0.01 0.01 ]);
0709         hold off
0710     end
0711     colormap('JET');
0712 end
0713 
0714 if(get(handles.popupmenu5,'Value')==5) % Signatures T^2
0715     %recuperem les dades
0716     if get(handles.popupmenu3,'Value') == 1
0717         axes(handles.axes1);
0718         cla;
0719         if isfield(handles, 'plot') 
0720             handles=rmfield(handles,'plot');
0721         end
0722         hold on
0723         %es el del Cross validation
0724         mdades=get(handles.popupmenu1,'Value');
0725         mdades=['var_temp_CBR{' num2str(mdades) '}.getCaseBase.plotT2Signatures();'];%DATA
0726         evalin('base',mdades);
0727         legend(get(legend,'String'),'Location',[0.15 0.1 0.01 0.01 ]);
0728         hold off
0729     else
0730         axes(handles.axes1);
0731         cla;
0732         if isfield(handles, 'plot')
0733             handles=rmfield(handles,'plot');
0734         end
0735         hold on
0736         %el que ens hagin indicat
0737         variable=get(handles.popupmenu1,'String');
0738         mdades=variable{get(handles.popupmenu1,'Value')};
0739         
0740         if strcmp(mdades(1:min(end,9)), 'Division ')
0741             mdades = ['temp_CBR{' mdades(10:end) '}'];
0742         end
0743         
0744         mdades=[mdades '.getCaseBase.plotT2Signatures();'];%DATA
0745         evalin('base',mdades);
0746         legend(get(legend,'String'),'Location',[0.15 0.1 0.01 0.01 ]);
0747         hold off
0748     end
0749     colormap('JET');
0750 end
0751 guidata(hObject, handles);
0752 listbox2_Callback(hObject, eventdata, handles)
0753 
0754 function popupmenu5_CreateFcn(hObject, ~, ~)
0755 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0756     set(hObject,'BackgroundColor','white');
0757 end
0758 
0759 
0760 function pushbutton3_Callback(~, ~, handles)
0761 aux=get(handles.axes1, 'children');
0762 if length(aux) >= 3
0763     set(gca, 'children',aux([1:length(aux)-2 length(aux) length(aux)-1])');
0764 end
0765 drawnow

Generated on Wed 12-Sep-2012 13:03:54 by m2html © 2005