Home > . > prt_ui_cv.m

prt_ui_cv

PURPOSE ^

PRT_UI_KERNEL_CONSTRUCTION M-file for prt_ui_kernel_construction.fig

SYNOPSIS ^

function varargout = prt_ui_cv(varargin)

DESCRIPTION ^

 PRT_UI_KERNEL_CONSTRUCTION M-file for prt_ui_kernel_construction.fig
      PRT_UI_KERNEL_CONSTRUCTION, by itself, creates a new PRT_UI_KERNEL_CONSTRUCTION or raises the existing
      singleton*.

      H = PRT_UI_KERNEL_CONSTRUCTION returns the handle to a new PRT_UI_KERNEL_CONSTRUCTION or the handle to
      the existing singleton*.

      PRT_UI_KERNEL_CONSTRUCTION('CALLBACK',hObject,eventData,handles,...) calls the local
      function named CALLBACK in PRT_UI_KERNEL_CONSTRUCTION.M with the given input arguments.

      PRT_UI_KERNEL_CONSTRUCTION('Property','Value',...) creates a new PRT_UI_KERNEL_CONSTRUCTION or raises the
      existing singleton*.  Starting from the left, property value pairs are
      applied to the GUI before prt_ui_kernel_construction_OpeningFcn gets called.  An
      unrecognized property name or invalid value makes property application
      stop.  All inputs are passed to prt_ui_kernel_construction_OpeningFcn via varargin.

      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
      instance to run (singleton)".

 See also: GUIDE, GUIDATA, GUIHANDLES
__________________________________________________________________________
 Copyright (C) 2011 Machine Learning & Neuroimaging Laboratory

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function varargout = prt_ui_cv(varargin)
0002 % PRT_UI_KERNEL_CONSTRUCTION M-file for prt_ui_kernel_construction.fig
0003 %      PRT_UI_KERNEL_CONSTRUCTION, by itself, creates a new PRT_UI_KERNEL_CONSTRUCTION or raises the existing
0004 %      singleton*.
0005 %
0006 %      H = PRT_UI_KERNEL_CONSTRUCTION returns the handle to a new PRT_UI_KERNEL_CONSTRUCTION or the handle to
0007 %      the existing singleton*.
0008 %
0009 %      PRT_UI_KERNEL_CONSTRUCTION('CALLBACK',hObject,eventData,handles,...) calls the local
0010 %      function named CALLBACK in PRT_UI_KERNEL_CONSTRUCTION.M with the given input arguments.
0011 %
0012 %      PRT_UI_KERNEL_CONSTRUCTION('Property','Value',...) creates a new PRT_UI_KERNEL_CONSTRUCTION or raises the
0013 %      existing singleton*.  Starting from the left, property value pairs are
0014 %      applied to the GUI before prt_ui_kernel_construction_OpeningFcn gets called.  An
0015 %      unrecognized property name or invalid value makes property application
0016 %      stop.  All inputs are passed to prt_ui_kernel_construction_OpeningFcn via varargin.
0017 %
0018 %      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
0019 %      instance to run (singleton)".
0020 %
0021 % See also: GUIDE, GUIDATA, GUIHANDLES
0022 %__________________________________________________________________________
0023 % Copyright (C) 2011 Machine Learning & Neuroimaging Laboratory
0024 
0025 % Written by J. Schrouff
0026 % $Id: prt_ui_cv.m 135 2011-10-11 10:21:27Z amarquan $
0027 
0028 % Edit the above text to modify the response to help prt_ui_kernel_construction
0029 
0030 % Last Modified by GUIDE v2.5 26-Sep-2011 11:09:43
0031 
0032 % Begin initialization code - DO NOT EDIT
0033 gui_Singleton = 1;
0034 gui_State = struct('gui_Name',       mfilename, ...
0035                    'gui_Singleton',  gui_Singleton, ...
0036                    'gui_OpeningFcn', @prt_ui_kernel_construction_OpeningFcn, ...
0037                    'gui_OutputFcn',  @prt_ui_kernel_construction_OutputFcn, ...
0038                    'gui_LayoutFcn',  [] , ...
0039                    'gui_Callback',   []);
0040 if nargin && ischar(varargin{1})
0041     gui_State.gui_Callback = str2func(varargin{1});
0042 end
0043 
0044 if nargout
0045     [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
0046 else
0047     gui_mainfcn(gui_State, varargin{:});
0048 end
0049 % End initialization code - DO NOT EDIT
0050 
0051 
0052 % --- Executes just before prt_ui_kernel_construction is made visible.
0053 function prt_ui_kernel_construction_OpeningFcn(hObject, eventdata, handles, varargin)
0054 % This function has no output args, see OutputFcn.
0055 % hObject    handle to figure
0056 % eventdata  reserved - to be defined in a future version of MATLAB
0057 % handles    structure with handles and user data (see GUIDATA)
0058 % varargin   command line arguments to prt_ui_kernel_construction (see VARARGIN)
0059 
0060 % Choose default command line output for prt_ui_kernel_construction
0061 handles.output = hObject;
0062 set(handles.group_list,'Enable','off')
0063 set(handles.uns_list,'Enable','off')
0064 set(handles.sel_list,'Enable','off')
0065 set(handles.uns_cond_list,'Enable','off')
0066 set(handles.sel_cond_list,'Enable','off')
0067 set(handles.sel_all,'Enable','off')
0068 set(handles.sel_cond_all,'Enable','off');
0069 set(handles.pop_compa,'String',{'Groups', 'Conditions'})
0070 
0071 % Update handles structure
0072 guidata(hObject, handles);
0073 
0074 % UIWAIT makes prt_ui_kernel_construction wait for user response (see UIRESUME)
0075 % uiwait(handles.figure1);
0076 
0077 
0078 % --- Outputs from this function are returned to the command line.
0079 function varargout = prt_ui_kernel_construction_OutputFcn(hObject, eventdata, handles) 
0080 % varargout  cell array for returning output args (see VARARGOUT);
0081 % hObject    handle to figure
0082 % eventdata  reserved - to be defined in a future version of MATLAB
0083 % handles    structure with handles and user data (see GUIDATA)
0084 
0085 % Get default command line output from handles structure
0086 varargout{1} = handles.output;
0087 
0088 
0089 % --- Executes on button press in br_prt.
0090 function br_prt_Callback(hObject, eventdata, handles)
0091 % hObject    handle to br_prt (see GCBO)
0092 % eventdata  reserved - to be defined in a future version of MATLAB
0093 % handles    structure with handles and user data (see GUIDATA)
0094 fname=spm_select(1,'.mat','Select PRT.mat',[],pwd,'PRT.mat');
0095 try
0096     load(fname)
0097     handles.dat=PRT;
0098     set(handles.edit_prt,'String',fname);
0099 catch
0100     beep
0101     disp('Could not load file')
0102     return
0103 end
0104 %get names of modalities
0105 list={handles.dat.masks(:).mod_name};
0106 set(handles.pop_mod,'String',list);
0107 nm=length(list);
0108 %get names of groups
0109 list={handles.dat.group(:).gr_name};
0110 ng=length(list);
0111 set(handles.group_list,'String',list)
0112 set(handles.group_list,'Value',1)
0113 list={handles.dat.group(1).subject(:).subj_name};
0114 set(handles.uns_list,'String',list);
0115 set(handles.sel_list,'String',{}); 
0116 handles.condm=cell(nm,3);
0117 %get the conditions which are common to all groups and subjects for the
0118 %different modalities
0119 for i=1:nm
0120     handles.condm{i,1}=get(handles.group_list,'String');
0121     handles.condm{i,3}=cell(length(get(handles.group_list,'String')),1);
0122     flag=1;
0123     for j=1:ng
0124         handles.condm{i,3}{j}={handles.dat.group(j).subject(:).subj_name};
0125         for k=1:length(handles.dat.group(j).subject)
0126             des=handles.dat.group(j).subject(k).modality(nm).design;
0127             if isstruct(des) && flag
0128                 if k==1
0129                     lcond={des.conds(:).cond_name};
0130                 else
0131                     tocmp={des.conds(:).cond_name};
0132                     for xx=1:length(lcond)
0133                         if ~any(strcmpi(lcond(i),tocmp))
0134                             ind=1:length(lcond);
0135                             nind=setdiff(ind,i);
0136                             lcond=lcond(nind);
0137                         end
0138                     end
0139                 end
0140             else
0141                 handles.condm{i,2}=0;
0142                 flag=0;
0143             end
0144         end
0145     end
0146     handles.condm{i,2}=lcond;
0147 end
0148 handles.clas=cell(nm);
0149 % Update handles structure
0150 guidata(hObject, handles);
0151 
0152 function edit_prt_Callback(hObject, eventdata, handles)
0153 % hObject    handle to edit_prt (see GCBO)
0154 % eventdata  reserved - to be defined in a future version of MATLAB
0155 % handles    structure with handles and user data (see GUIDATA)
0156 
0157 % Hints: get(hObject,'String') returns contents of edit_prt as text
0158 %        str2double(get(hObject,'String')) returns contents of edit_prt as a double
0159 fname=get(handles.edit_prt,'String');
0160 try
0161     load(fname)
0162     handles.dat=PRT;
0163 catch
0164     beep
0165     disp('Could not load file')
0166     return
0167 end
0168 %get names of modalities
0169 list={handles.dat.masks(:).mod_name};
0170 nm=length(list);
0171 set(handles.pop_mod,'String',list);
0172 %get names of groups
0173 list={handles.dat.group(:).gr_name};
0174 ng=length(list);
0175 set(handles.group_list,'String',list)
0176 set(handles.group_list,'Value',1)
0177 list={handles.dat.group(1).subject(:).subj_name};
0178 set(handles.uns_list,'String',list);
0179 set(handles.sel_list,'String',{});
0180 handles.condm=cell(nm,3);
0181 %get the conditions which are common to all groups and subjects for the
0182 %different modalities
0183 for i=1:nm
0184     handles.condm{i,1}=get(handles.uns_list,'String');
0185     handles.condm{i,3}=cell(length(get(handles.group_list,'String')),1);
0186     flag=1;
0187     for j=1:ng
0188         handles.condm{i,3}{j}={handles.dat.group(j).subject(:).subj_name};
0189         for k=1:length(handles.dat.group(j).subject)
0190             des=handles.dat.group(j).subject(k).modality(nm).design;
0191             if isstruct(des) && flag
0192                 if k==1
0193                     lcond={des.conds(:).cond_name};
0194                 else
0195                     tocmp={des.conds(:).cond_name};
0196                     for xx=1:length(lcond)
0197                         if ~any(strcmpi(lcond(i),tocmp))
0198                             ind=1:length(lcond);
0199                             nind=setdiff(ind,i);
0200                             lcond=lcond(nind);
0201                         end
0202                     end
0203                 end
0204             else
0205                 handles.condm{i,2}=0;
0206                 flag=0;
0207             end
0208         end
0209     end
0210     handles.condm{i,2}=lcond;
0211 end
0212 handles.clas=cell(nm);
0213 %set the lists as the conditions of the first modality
0214 set(handles.uns_cond_list,'String',handles.condm{1,2});
0215 set(handles.sel_cond_list,'String',{});
0216 % Update handles structure
0217 guidata(hObject, handles);
0218 
0219 % --- Executes during object creation, after setting all properties.
0220 function edit_prt_CreateFcn(hObject, eventdata, handles)
0221 % hObject    handle to edit_prt (see GCBO)
0222 % eventdata  reserved - to be defined in a future version of MATLAB
0223 % handles    empty - handles not created until after all CreateFcns called
0224 
0225 % Hint: edit controls usually have a white background on Windows.
0226 %       See ISPC and COMPUTER.
0227 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0228     set(hObject,'BackgroundColor','white');
0229 end
0230 
0231 % --- Executes on selection change in pop_mod.
0232 function pop_mod_Callback(hObject, eventdata, handles)
0233 % hObject    handle to pop_mod (see GCBO)
0234 % eventdata  reserved - to be defined in a future version of MATLAB
0235 % handles    structure with handles and user data (see GUIDATA)
0236 
0237 % Hints: contents = get(hObject,'String') returns pop_mod contents as cell array
0238 %        contents{get(hObject,'Value')} returns selected item from pop_mod
0239 mname=get(handles.pop_mod,'String');
0240 val=find(strcmpi({handles.dat.group(1).subject(1).modality(:).mod_name},mname));
0241 des=handles.dat.group(1).subject(1).modality(val).design;
0242 set(handles.group_list,'Value',1);
0243 if ~isstruct(des)
0244     set(handles.uns_cond_list,'Enable','off')
0245     set(handles.sel_cond_list,'Enable','off');
0246     set(handles.sel_cond_all,'Enable','off');
0247     set(handles.pop_compa,'Value',1);
0248     lcv={'Leave One Out','Leave 2 out','Leave Half Out'};
0249     lval={'No','Leave One Out','Leave 2 out'};
0250 else
0251     if ~isnumeric(get(handles.num_class,'String'))
0252         set(handles.uns_cond_list,'String',handles.condm{val,2});
0253         set(handles.sel_cond_list,'String',{});
0254         set(handles.uns_list,'String',handles.condm{val,3}{1});
0255         set(handles.sel_list,'String',{});
0256     else
0257         set(handles.uns_cond_list,'String',handles.condm{val,2});
0258         set(handles.sel_cond_list,'String',{});
0259         set(handles.uns_list,'String',handles.condm{val,3}{1});
0260         set(handles.sel_list,'String',{});
0261     end
0262     lcv={'Leave One Out','Leave 2 out','Leave Block Out','Leave Half Out'};
0263     lval={'No','Leave One Out','Leave 2 out','Leave Block Out'};
0264 end
0265 set(handles.pop_cv,'String',lcv);
0266 set(handles.pop_val,'String',lval);
0267 % Update handles structure
0268 guidata(hObject, handles);
0269 
0270 
0271 % --- Executes during object creation, after setting all properties.
0272 function pop_mod_CreateFcn(hObject, eventdata, handles)
0273 % hObject    handle to pop_mod (see GCBO)
0274 % eventdata  reserved - to be defined in a future version of MATLAB
0275 % handles    empty - handles not created until after all CreateFcns called
0276 
0277 % Hint: popupmenu controls usually have a white background on Windows.
0278 %       See ISPC and COMPUTER.
0279 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0280     set(hObject,'BackgroundColor','white');
0281 end
0282 
0283 
0284 % --- Executes on selection change in pop_compa.
0285 function pop_compa_Callback(hObject, eventdata, handles)
0286 % hObject    handle to pop_compa (see GCBO)
0287 % eventdata  reserved - to be defined in a future version of MATLAB
0288 % handles    structure with handles and user data (see GUIDATA)
0289 
0290 % Hints: contents = get(hObject,'String') returns pop_compa contents as cell array
0291 %        contents{get(hObject,'Value')} returns selected item from pop_compa
0292 
0293 
0294 % --- Executes during object creation, after setting all properties.
0295 function pop_compa_CreateFcn(hObject, eventdata, handles)
0296 % hObject    handle to pop_compa (see GCBO)
0297 % eventdata  reserved - to be defined in a future version of MATLAB
0298 % handles    empty - handles not created until after all CreateFcns called
0299 
0300 % Hint: popupmenu controls usually have a white background on Windows.
0301 %       See ISPC and COMPUTER.
0302 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0303     set(hObject,'BackgroundColor','white');
0304 end
0305 
0306 
0307 function num_class_Callback(hObject, eventdata, handles)
0308 % hObject    handle to num_class (see GCBO)
0309 % eventdata  reserved - to be defined in a future version of MATLAB
0310 % handles    structure with handles and user data (see GUIDATA)
0311 
0312 % Hints: get(hObject,'String') returns contents of num_class as text
0313 %        str2double(get(hObject,'String')) returns contents of num_class as a double
0314 ncl=str2double(get(handles.num_class,'String'));
0315 if isnan(ncl)
0316     return
0317 end
0318 %set the names of the classes in the pop_class
0319 cl={};
0320 for i=1:ncl
0321     cl=[cl,{['Class ',num2str(i)]}];
0322 end
0323 set(handles.pop_class,'String',cl);
0324 set(handles.pop_class,'Value',1);
0325 %for each class of that modality, build a cell containing the indexes of
0326 %the selected groups and conditions
0327 val=get(handles.pop_mod,'Value');
0328 handles.clas{val}=cell(ncl,4);
0329 for i=1:ncl
0330     handles.clas{val}{i,1}=1:length(handles.condm{val,1});
0331     handles.clas{val}{i,2}=cell(length(handles.condm{val,1}),2);
0332     for j=1:length(get(handles.group_list,'String'))
0333         handles.clas{val}{i,2}{j,1}=1:length(handles.condm{val,3}{j});
0334         handles.clas{val}{i,2}{j,2}=0;
0335     end
0336     handles.clas{val}{i,3}=1:length(handles.condm{val,2});
0337     handles.clas{val}{i,4}=0;
0338 end
0339     
0340 % Update handles structure
0341 guidata(hObject, handles);
0342  
0343 
0344 % --- Executes during object creation, after setting all properties.
0345 function num_class_CreateFcn(hObject, eventdata, handles)
0346 % hObject    handle to num_class (see GCBO)
0347 % eventdata  reserved - to be defined in a future version of MATLAB
0348 % handles    empty - handles not created until after all CreateFcns called
0349 
0350 % Hint: edit controls usually have a white background on Windows.
0351 %       See ISPC and COMPUTER.
0352 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0353     set(hObject,'BackgroundColor','white');
0354 end
0355 
0356 
0357 % --- Executes on selection change in pop_class.
0358 function pop_class_Callback(hObject, eventdata, handles)
0359 % hObject    handle to pop_class (see GCBO)
0360 % eventdata  reserved - to be defined in a future version of MATLAB
0361 % handles    structure with handles and user data (see GUIDATA)
0362 
0363 % Hints: contents = get(hObject,'String') returns pop_class contents as cell array
0364 %        contents{get(hObject,'Value')} returns selected item from pop_class
0365 %initialize the conditions structure for each group and modality
0366 vc=get(handles.pop_class,'Value');
0367 val=get(handles.pop_mod,'Value');
0368 cg=get(handles.group_list,'Value');
0369 list=handles.condm{val,3}{cg};
0370 clist=handles.condm{val,2};
0371 %set subjects lists
0372 if handles.clas{val}{vc,2}{cg,1}~=0
0373     set(handles.uns_list,'Value',1);
0374     set(handles.uns_list,'String',list(handles.clas{val}{vc,2}{cg,1}));
0375 else
0376     set(handles.uns_list,'Value',0);
0377     set(handles.uns_list,'String',{});
0378 end
0379 if handles.clas{val}{vc,2}{cg,2}~=0
0380     set(handles.sel_list,'Value',1);
0381     set(handles.sel_list,'String',list(handles.clas{val}{vc,2}{cg,2}));
0382 else
0383     set(handles.sel_list,'Value',0);
0384     set(handles.sel_list,'String',{});
0385 end
0386 %set conditions lists
0387 if handles.clas{val}{vc,3}~=0
0388     set(handles.uns_cond_list,'Value',1);
0389     set(handles.uns_cond_list,'String',clist(handles.clas{val}{vc,3}));
0390 else
0391     set(handles.uns_cond_list,'Value',0);
0392     set(handles.uns_cond_list,'String',{});
0393 end
0394 if handles.clas{val}{vc,4}~=0
0395     set(handles.sel_cond_list,'Value',1);
0396     set(handles.sel_cond_list,'String',clist(handles.clas{val}{vc,4}));
0397 else
0398     set(handles.sel_cond_list,'Value',0);
0399     set(handles.sel_cond_list,'String',{});
0400 end
0401 set(handles.uns_cond_list,'Enable','on');
0402 set(handles.sel_cond_list,'Enable','on');
0403 set(handles.sel_cond_all,'Enable','on');
0404 set(handles.uns_list,'Enable','on');
0405 set(handles.sel_list,'Enable','on');
0406 set(handles.sel_all,'Enable','on');
0407 set(handles.group_list,'Enable','on');
0408 % Update handles structure
0409 guidata(hObject, handles);
0410 
0411 
0412 % --- Executes during object creation, after setting all properties.
0413 function pop_class_CreateFcn(hObject, eventdata, handles)
0414 % hObject    handle to pop_class (see GCBO)
0415 % eventdata  reserved - to be defined in a future version of MATLAB
0416 % handles    empty - handles not created until after all CreateFcns called
0417 
0418 % Hint: popupmenu controls usually have a white background on Windows.
0419 %       See ISPC and COMPUTER.
0420 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0421     set(hObject,'BackgroundColor','white');
0422 end
0423 
0424 % --- Executes on selection change in group_list.
0425 function group_list_Callback(hObject, eventdata, handles)
0426 % hObject    handle to group_list (see GCBO)
0427 % eventdata  reserved - to be defined in a future version of MATLAB
0428 % handles    structure with handles and user data (see GUIDATA)
0429 
0430 % Hints: contents = get(hObject,'String') returns group_list contents as cell array
0431 %        contents{get(hObject,'Value')} returns selected item from group_list
0432 cl=get(handles.pop_class,'Value');
0433 cm=get(handles.pop_mod,'Value');
0434 cg=get(handles.group_list,'Value');
0435 list=handles.condm{cm,3}{cg};
0436 %set subjects lists
0437 if handles.clas{cm}{cl,2}{cg,1}~=0
0438     set(handles.uns_list,'Value',1);
0439     set(handles.uns_list,'String',list(handles.clas{cm}{cl,2}{cg,1}));
0440 else
0441     set(handles.uns_list,'Value',0);
0442     set(handles.uns_list,'String',{});
0443 end
0444 if handles.clas{cm}{cl,2}{cg,2}~=0
0445     set(handles.sel_list,'Value',1);
0446     set(handles.sel_list,'String',list(handles.clas{cm}{cl,2}{cg,2}));
0447 else
0448     set(handles.sel_list,'Value',0);
0449     set(handles.sel_list,'String',{});
0450 end
0451 % Update handles structure
0452 guidata(hObject, handles);
0453 
0454 % --- Executes during object creation, after setting all properties.
0455 function group_list_CreateFcn(hObject, eventdata, handles)
0456 % hObject    handle to group_list (see GCBO)
0457 % eventdata  reserved - to be defined in a future version of MATLAB
0458 % handles    empty - handles not created until after all CreateFcns called
0459 
0460 % Hint: listbox controls usually have a white background on Windows.
0461 %       See ISPC and COMPUTER.
0462 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0463     set(hObject,'BackgroundColor','white');
0464 end
0465 
0466 % --- Executes on selection change in uns_list.
0467 function uns_list_Callback(hObject, eventdata, handles)
0468 % hObject    handle to uns_list (see GCBO)
0469 % eventdata  reserved - to be defined in a future version of MATLAB
0470 % handles    structure with handles and user data (see GUIDATA)
0471 
0472 % Hints: contents = get(hObject,'String') returns uns_list contents as cell array
0473 %        contents{get(hObject,'Value')} returns selected item from uns_list
0474 val=get(handles.uns_list,'Value');
0475 induns=1:length(get(handles.uns_list,'String'));
0476 indok=setdiff(induns,val);
0477 cl=get(handles.pop_class,'Value');
0478 cm=get(handles.pop_mod,'Value');
0479 cg=get(handles.group_list,'Value');
0480 if handles.clas{cm}{cl,2}{cg,2}==0
0481     handles.clas{cm}{cl,2}{cg,2}=handles.clas{cm}{cl,2}{cg,1}(val);
0482 else
0483     handles.clas{cm}{cl,2}{cg,2}=[handles.clas{cm}{cl,2}{cg,2}, handles.clas{cm}{cl,2}{cg,1}(val)];
0484 end
0485 if isempty(indok)
0486     handles.clas{cm}{cl,2}{cg,1}=0;
0487 else
0488     handles.clas{cm}{cl,2}{cg,1}=handles.clas{cm}{cl,2}{cg,1}(indok);
0489 end
0490 list=handles.condm{cm,3}{cg};
0491 %set subjects lists
0492 if handles.clas{cm}{cl,2}{cg,1}~=0
0493     set(handles.uns_list,'Value',1);
0494     set(handles.uns_list,'String',list(handles.clas{cm}{cl,2}{cg,1}));
0495 else
0496     set(handles.uns_list,'Value',0);
0497     set(handles.uns_list,'String',{});
0498 end
0499 if handles.clas{cm}{cl,2}{cg,2}~=0
0500     set(handles.sel_list,'Value',1);
0501     set(handles.sel_list,'String',list(handles.clas{cm}{cl,2}{cg,2}));
0502 else
0503     set(handles.sel_list,'Value',0);
0504     set(handles.sel_list,'String',{});
0505 end
0506 
0507 % Update handles structure
0508 guidata(hObject, handles);
0509 
0510 % --- Executes during object creation, after setting all properties.
0511 function uns_list_CreateFcn(hObject, eventdata, handles)
0512 % hObject    handle to uns_list (see GCBO)
0513 % eventdata  reserved - to be defined in a future version of MATLAB
0514 % handles    empty - handles not created until after all CreateFcns called
0515 
0516 % Hint: listbox controls usually have a white background on Windows.
0517 %       See ISPC and COMPUTER.
0518 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0519     set(hObject,'BackgroundColor','white');
0520 end
0521 
0522 
0523 % --- Executes on selection change in sel_list.
0524 function sel_list_Callback(hObject, eventdata, handles)
0525 % hObject    handle to sel_list (see GCBO)
0526 % eventdata  reserved - to be defined in a future version of MATLAB
0527 % handles    structure with handles and user data (see GUIDATA)
0528 
0529 % Hints: contents = get(hObject,'String') returns sel_list contents as cell array
0530 %        contents{get(hObject,'Value')} returns selected item from sel_list
0531 val=get(handles.sel_list,'Value');
0532 indsel=1:length(get(handles.sel_list,'String'));
0533 indok=setdiff(indsel,val);
0534 cl=get(handles.pop_class,'Value');
0535 cm=get(handles.pop_mod,'Value');
0536 cg=get(handles.group_list,'Value');
0537 if handles.clas{cm}{cl,2}{cg,1}==0
0538     handles.clas{cm}{cl,2}{cg,1}=handles.clas{cm}{cl,2}{cg,2}(val);
0539 else
0540     handles.clas{cm}{cl,2}{cg,1}=[handles.clas{cm}{cl,2}{cg,1}, handles.clas{cm}{cl,2}{cg,2}(val)];
0541 end
0542 if isempty(indok)
0543     handles.clas{cm}{cl,2}{cg,2}=0;
0544 else
0545     handles.clas{cm}{cl,2}{cg,2}=handles.clas{cm}{cl,2}{cg,2}(indok);
0546 end
0547 list=handles.condm{cm,3}{cg};
0548 %set subjects lists
0549 if handles.clas{cm}{cl,2}{cg,1}~=0
0550     set(handles.uns_list,'String',list(handles.clas{cm}{cl,2}{cg,1}));
0551     set(handles.uns_list,'Value',length(get(handles.uns_list,'String')));
0552 else
0553     set(handles.uns_list,'Value',0);
0554     set(handles.uns_list,'String',{});
0555 end
0556 if handles.clas{cm}{cl,2}{cg,2}~=0
0557     set(handles.sel_list,'String',list(handles.clas{cm}{cl,2}{cg,2}));
0558     set(handles.sel_list,'Value',length(get(handles.sel_list,'String')));
0559 else
0560     set(handles.sel_list,'Value',0);
0561     set(handles.sel_list,'String',{});
0562 end
0563 % Update handles structure
0564 guidata(hObject, handles);
0565 
0566 % --- Executes during object creation, after setting all properties.
0567 function sel_list_CreateFcn(hObject, eventdata, handles)
0568 % hObject    handle to sel_list (see GCBO)
0569 % eventdata  reserved - to be defined in a future version of MATLAB
0570 % handles    empty - handles not created until after all CreateFcns called
0571 
0572 % Hint: listbox controls usually have a white background on Windows.
0573 %       See ISPC and COMPUTER.
0574 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0575     set(hObject,'BackgroundColor','white');
0576 end
0577 
0578 
0579 % --- Executes on button press in sel_all.
0580 function sel_all_Callback(hObject, eventdata, handles)
0581 % hObject    handle to sel_all (see GCBO)
0582 % eventdata  reserved - to be defined in a future version of MATLAB
0583 % handles    structure with handles and user data (see GUIDATA)
0584 cl=get(handles.pop_class,'Value');
0585 cm=get(handles.pop_mod,'Value');
0586 cg=get(handles.group_list,'Value');
0587 list=handles.condm{cm,3}{cg,1};
0588 indsel=1:length(list);
0589 handles.clas{cm}{cl,2}{cg,2}=indsel;
0590 handles.clas{cm}{cl,2}{cg,1}=0;
0591 set(handles.uns_list,'String',{});
0592 set(handles.uns_list,'Value',0);
0593 set(handles.sel_list,'String',list(handles.clas{cm}{cl,2}{cg,2}));
0594 set(handles.sel_list,'Value',length(get(handles.sel_list,'String')));
0595 % Update handles structure
0596 guidata(hObject, handles);
0597 
0598 % --- Executes on selection change in uns_cond_list.
0599 function uns_cond_list_Callback(hObject, eventdata, handles)
0600 % hObject    handle to uns_cond_list (see GCBO)
0601 % eventdata  reserved - to be defined in a future version of MATLAB
0602 % handles    structure with handles and user data (see GUIDATA)
0603 
0604 % Hints: contents = get(hObject,'String') returns uns_cond_list contents as cell array
0605 %        contents{get(hObject,'Value')} returns selected item from uns_cond_list
0606 val=get(handles.uns_cond_list,'Value');
0607 induns=1:length(get(handles.uns_cond_list,'String'));
0608 indok=setdiff(induns,val);
0609 cl=get(handles.pop_class,'Value');
0610 cm=get(handles.pop_mod,'Value');
0611 if handles.clas{cm}{cl,4}==0
0612     handles.clas{cm}{cl,4}=handles.clas{cm}{cl,3}(val);
0613 else
0614     handles.clas{cm}{cl,4}=[handles.clas{cm}{cl,4}, handles.clas{cm}{cl,3}(val)];
0615 end
0616 if isempty(indok)
0617     handles.clas{cm}{cl,3}=0;
0618 else
0619     handles.clas{cm}{cl,3}=handles.clas{cm}{cl,3}(indok);
0620 end
0621 %set conditions lists
0622 clist=handles.condm{cm,2};
0623 if handles.clas{cm}{cl,3}~=0
0624     set(handles.uns_cond_list,'Value',1);
0625     set(handles.uns_cond_list,'String',clist(handles.clas{cm}{cl,3}));
0626 else
0627     set(handles.uns_cond_list,'Value',0);
0628     set(handles.uns_cond_list,'String',{});
0629 end
0630 if handles.clas{cm}{cl,4}~=0
0631     set(handles.sel_cond_list,'Value',1);
0632     set(handles.sel_cond_list,'String',clist(handles.clas{cm}{cl,4}));
0633 else
0634     set(handles.sel_cond_list,'Value',0);
0635     set(handles.sel_cond_list,'String',{});
0636 end
0637 % Update handles structure
0638 guidata(hObject, handles);
0639 
0640 % --- Executes during object creation, after setting all properties.
0641 function uns_cond_list_CreateFcn(hObject, eventdata, handles)
0642 % hObject    handle to uns_cond_list (see GCBO)
0643 % eventdata  reserved - to be defined in a future version of MATLAB
0644 % handles    empty - handles not created until after all CreateFcns called
0645 
0646 % Hint: listbox controls usually have a white background on Windows.
0647 %       See ISPC and COMPUTER.
0648 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0649     set(hObject,'BackgroundColor','white');
0650 end
0651 
0652 
0653 % --- Executes on selection change in sel_cond_list.
0654 function sel_cond_list_Callback(hObject, eventdata, handles)
0655 % hObject    handle to sel_cond_list (see GCBO)
0656 % eventdata  reserved - to be defined in a future version of MATLAB
0657 % handles    structure with handles and user data (see GUIDATA)
0658 
0659 % Hints: contents = get(hObject,'String') returns sel_cond_list contents as cell array
0660 %        contents{get(hObject,'Value')} returns selected item from sel_cond_list
0661 val=get(handles.sel_cond_list,'Value');
0662 induns=1:length(get(handles.sel_cond_list,'String'));
0663 indok=setdiff(induns,val);
0664 cl=get(handles.pop_class,'Value');
0665 cm=get(handles.pop_mod,'Value');
0666 if handles.clas{cm}{cl,3}==0
0667     handles.clas{cm}{cl,3}=handles.clas{cm}{cl,4}(val);
0668 else
0669     handles.clas{cm}{cl,3}=[handles.clas{cm}{cl,3}, handles.clas{cm}{cl,4}(val)];
0670 end
0671 if isempty(indok)
0672     handles.clas{cm}{cl,4}=0;
0673 else
0674     handles.clas{cm}{cl,4}=handles.clas{cm}{cl,4}(indok);
0675 end
0676 %set conditions lists
0677 clist=handles.condm{cm,2};
0678 if handles.clas{cm}{cl,3}~=0
0679     set(handles.uns_cond_list,'String',clist(handles.clas{cm}{cl,3}));
0680     set(handles.uns_cond_list,'Value',length(get(handles.uns_cond_list,'String')));
0681 else
0682     set(handles.uns_cond_list,'Value',0);
0683     set(handles.uns_cond_list,'String',{});
0684 end
0685 if handles.clas{cm}{cl,4}~=0
0686     set(handles.sel_cond_list,'String',clist(handles.clas{cm}{cl,4}));
0687     set(handles.sel_cond_list,'Value',length(get(handles.sel_cond_list,'String')));
0688 else
0689     set(handles.sel_cond_list,'Value',0);
0690     set(handles.sel_cond_list,'String',{});
0691 end
0692 % Update handles structure
0693 guidata(hObject, handles);
0694 
0695 % --- Executes during object creation, after setting all properties.
0696 function sel_cond_list_CreateFcn(hObject, eventdata, handles)
0697 % hObject    handle to sel_cond_list (see GCBO)
0698 % eventdata  reserved - to be defined in a future version of MATLAB
0699 % handles    empty - handles not created until after all CreateFcns called
0700 
0701 % Hint: listbox controls usually have a white background on Windows.
0702 %       See ISPC and COMPUTER.
0703 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0704     set(hObject,'BackgroundColor','white');
0705 end
0706 
0707 
0708 % --- Executes on button press in sel_cond_all.
0709 function sel_cond_all_Callback(hObject, eventdata, handles)
0710 % hObject    handle to sel_cond_all (see GCBO)
0711 % eventdata  reserved - to be defined in a future version of MATLAB
0712 % handles    structure with handles and user data (see GUIDATA)
0713 cl=get(handles.pop_class,'Value');
0714 cm=get(handles.pop_mod,'Value');
0715 list=handles.condm{cm,2};
0716 indsel=1:length(list);
0717 handles.clas{cm}{cl,4}=indsel;
0718 handles.clas{cm}{cl,3}=0;
0719 set(handles.uns_cond_list,'String',{});
0720 set(handles.uns_cond_list,'Value',0);
0721 set(handles.sel_cond_list,'String',list(handles.clas{cm}{cl,4}));
0722 set(handles.sel_cond_list,'Value',length(get(handles.sel_cond_list,'String')));
0723 % Update handles structure
0724 guidata(hObject, handles);
0725 
0726 % --- Executes on selection change in pop_cv.
0727 function pop_cv_Callback(hObject, eventdata, handles)
0728 % hObject    handle to pop_cv (see GCBO)
0729 % eventdata  reserved - to be defined in a future version of MATLAB
0730 % handles    structure with handles and user data (see GUIDATA)
0731 
0732 % Hints: contents = get(hObject,'String') returns pop_cv contents as cell array
0733 %        contents{get(hObject,'Value')} returns selected item from pop_cv
0734 
0735 
0736 % --- Executes during object creation, after setting all properties.
0737 function pop_cv_CreateFcn(hObject, eventdata, handles)
0738 % hObject    handle to pop_cv (see GCBO)
0739 % eventdata  reserved - to be defined in a future version of MATLAB
0740 % handles    empty - handles not created until after all CreateFcns called
0741 
0742 % Hint: popupmenu controls usually have a white background on Windows.
0743 %       See ISPC and COMPUTER.
0744 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0745     set(hObject,'BackgroundColor','white');
0746 end
0747 
0748 
0749 % --- Executes on selection change in pop_val.
0750 function pop_val_Callback(hObject, eventdata, handles)
0751 % hObject    handle to pop_val (see GCBO)
0752 % eventdata  reserved - to be defined in a future version of MATLAB
0753 % handles    structure with handles and user data (see GUIDATA)
0754 
0755 % Hints: contents = get(hObject,'String') returns pop_val contents as cell array
0756 %        contents{get(hObject,'Value')} returns selected item from pop_val
0757 
0758 
0759 % --- Executes during object creation, after setting all properties.
0760 function pop_val_CreateFcn(hObject, eventdata, handles)
0761 % hObject    handle to pop_val (see GCBO)
0762 % eventdata  reserved - to be defined in a future version of MATLAB
0763 % handles    empty - handles not created until after all CreateFcns called
0764 
0765 % Hint: popupmenu controls usually have a white background on Windows.
0766 %       See ISPC and COMPUTER.
0767 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0768     set(hObject,'BackgroundColor','white');
0769 end
0770 
0771 % --- Executes on button press in buildbutt.
0772 function buildbutt_Callback(hObject, eventdata, handles)
0773 % hObject    handle to buildbutt (see GCBO)
0774 % eventdata  reserved - to be defined in a future version of MATLAB
0775 % handles    structure with handles and user data (see GUIDATA)
0776 
0777 
0778 %--------------------------------------------------------------------------
0779 %-----------------------Subfunctions---------------------------------------
0780 %--------------------------------------------------------------------------
0781 
0782 function [co]=check_selection(handles)
0783

Generated on Thu 20-Oct-2011 11:56:23 by m2html © 2005