Home > src > createMatchCorrelztest_Dialog.m

createMatchCorrelztest_Dialog

PURPOSE ^

- create correlation-matching z-test dialog

SYNOPSIS ^

function varargout = createMatchCorrelztest_Dialog(varargin)

DESCRIPTION ^

 - create correlation-matching z-test dialog

 copyright 2009-2012 Blair Armstrong, Christine Watson, David Plaut

    This file is part of SOS

    SOS is free software: you can redistribute it and/or modify
    it for academic and non-commercial purposes
    under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.  For commercial or for-profit
    uses, please contact the authors (sos@cnbc.cmu.edu).

    SOS is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 % - create correlation-matching z-test dialog
0002 %
0003 % copyright 2009-2012 Blair Armstrong, Christine Watson, David Plaut
0004 %
0005 %    This file is part of SOS
0006 %
0007 %    SOS is free software: you can redistribute it and/or modify
0008 %    it for academic and non-commercial purposes
0009 %    under the terms of the GNU General Public License as published by
0010 %    the Free Software Foundation, either version 3 of the License, or
0011 %    (at your option) any later version.  For commercial or for-profit
0012 %    uses, please contact the authors (sos@cnbc.cmu.edu).
0013 %
0014 %    SOS is distributed in the hope that it will be useful,
0015 %    but WITHOUT ANY WARRANTY; without even the implied warranty of
0016 %    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0017 %    GNU General Public License for more details.
0018 
0019 %    You should have received a copy of the GNU General Public License
0020 %    along with SOS (see COPYING.txt).
0021 %    If not, see <http://www.gnu.org/licenses/>.
0022 
0023 
0024 
0025 
0026 function varargout = createMatchCorrelztest_Dialog(varargin)
0027 % CREATEMATCHCORRELZTEST_DIALOG M-file for createMatchCorrelztest_Dialog.fig
0028 %      CREATEMATCHCORRELZTEST_DIALOG, by itself, creates a new CREATEMATCHCORRELZTEST_DIALOG or raises the existing
0029 %      singleton*.
0030 %
0031 %      H = CREATEMATCHCORRELZTEST_DIALOG returns the handle to a new CREATEMATCHCORRELZTEST_DIALOG or the handle to
0032 %      the existing singleton*.
0033 %
0034 %      CREATEMATCHCORRELZTEST_DIALOG('CALLBACK',hObject,eventData,handles,...) calls the local
0035 %      function named CALLBACK in CREATEMATCHCORRELZTEST_DIALOG.M with the given input arguments.
0036 %
0037 %      CREATEMATCHCORRELZTEST_DIALOG('Property','Value',...) creates a new CREATEMATCHCORRELZTEST_DIALOG or raises the
0038 %      existing singleton*.  Starting from the left, property value pairs are
0039 %      applied to the GUI before createMatchCorrelztest_Dialog_OpeningFcn gets called.  An
0040 %      unrecognized property name or invalid value makes property application
0041 %      stop.  All inputs are passed to createMatchCorrelztest_Dialog_OpeningFcn via varargin.
0042 %
0043 %      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
0044 %      instance to run (singleton)".
0045 %
0046 % See also: GUIDE, GUIDATA, GUIHANDLES
0047 
0048 % Edit the above text to modify the response to help createMatchCorrelztest_Dialog
0049 
0050 % Last Modified by GUIDE v2.5 13-Aug-2011 22:36:26
0051 
0052 % Begin initialization code - DO NOT EDIT
0053 gui_Singleton = 1;
0054 gui_State = struct('gui_Name',       mfilename, ...
0055                    'gui_Singleton',  gui_Singleton, ...
0056                    'gui_OpeningFcn', @createMatchCorrelztest_Dialog_OpeningFcn, ...
0057                    'gui_OutputFcn',  @createMatchCorrelztest_Dialog_OutputFcn, ...
0058                    'gui_LayoutFcn',  [] , ...
0059                    'gui_Callback',   []);
0060 if nargin && ischar(varargin{1})
0061     gui_State.gui_Callback = str2func(varargin{1});
0062 end
0063 
0064 if nargout
0065     [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
0066 else
0067     gui_mainfcn(gui_State, varargin{:});
0068 end
0069 % End initialization code - DO NOT EDIT
0070 
0071 
0072 % --- Executes just before createMatchCorrelztest_Dialog is made visible.
0073 function createMatchCorrelztest_Dialog_OpeningFcn(hObject, eventdata, handles, varargin)
0074 % This function has no output args, see OutputFcn.
0075 % hObject    handle to figure
0076 % eventdata  reserved - to be defined in a future version of MATLAB
0077 % handles    structure with handles and user data (see GUIDATA)
0078 % varargin   command line arguments to createMatchCorrelztest_Dialog (see VARARGIN)
0079 
0080 % Choose default command line output for createMatchCorrelztest_Dialog
0081 handles.output = hObject;
0082 
0083 % Update handles structure
0084 guidata(hObject, handles);
0085 
0086 % UIWAIT makes createMatchCorrelztest_Dialog wait for user response (see UIRESUME)
0087 % uiwait(handles.figure_createMatchCorrelztest_Dialog);
0088 
0089 
0090 % --- Outputs from this function are returned to the command line.
0091 function varargout = createMatchCorrelztest_Dialog_OutputFcn(hObject, eventdata, handles) 
0092 % varargout  cell array for returning output args (see VARARGOUT);
0093 % hObject    handle to figure
0094 % eventdata  reserved - to be defined in a future version of MATLAB
0095 % handles    structure with handles and user data (see GUIDATA)
0096 
0097 % Get default command line output from handles structure
0098 varargout{1} = handles.output;
0099 
0100 
0101 
0102 function edit_name_Callback(hObject, eventdata, handles)
0103 % hObject    handle to edit_name (see GCBO)
0104 % eventdata  reserved - to be defined in a future version of MATLAB
0105 % handles    structure with handles and user data (see GUIDATA)
0106 
0107 % Hints: get(hObject,'String') returns contents of edit_name as text
0108 %        str2double(get(hObject,'String')) returns contents of edit_name as a double
0109     validate_name(handles);
0110     
0111 
0112 function flag = validate_name(handles)
0113 
0114     varName = get(handles.edit_name,'String');
0115     
0116     %check to make sure that the name is a valid variable name:
0117     valid = regexp(varName,'^[a-zA-Z]+\w*$', 'once');
0118     
0119     if isempty(valid)
0120         % name is not currently valid, tell the user.
0121         msgbox('Only letters, numbers, and underscores are permitted in the name of the ttest object.  The first character must also be a letter.',...
0122                 'Invalid name!');
0123         flag = false;
0124     else
0125         % check to make sure that the new variable name doesn't already exist.
0126         command = strcat('whos(''',varName,''')');
0127         varExists = evalin('base',command);
0128 
0129 
0130         % if a variable with this name already exists, warns the user
0131         if isempty(varExists) == 0
0132             msgbox('A variable with this name already exists and will be overridden if you continue',...
0133                     'Variable name already in use!');
0134         end
0135         
0136         flag = true;
0137     end
0138     
0139     
0140 
0141 % --- Executes during object creation, after setting all properties.
0142 function edit_name_CreateFcn(hObject, eventdata, handles)
0143 % hObject    handle to edit_name (see GCBO)
0144 % eventdata  reserved - to be defined in a future version of MATLAB
0145 % handles    empty - handles not created until after all CreateFcns called
0146 
0147 % Hint: edit controls usually have a white background on Windows.
0148 %       See ISPC and COMPUTER.
0149 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0150     set(hObject,'BackgroundColor','white');
0151 end
0152 
0153 
0154 % --- Executes on selection change in popupmenu_sample1Selector.
0155 function popupmenu_sample1Selector_Callback(hObject, eventdata, handles)
0156 % hObject    handle to popupmenu_sample1Selector (see GCBO)
0157 % eventdata  reserved - to be defined in a future version of MATLAB
0158 % handles    structure with handles and user data (see GUIDATA)
0159 
0160 % Hints: contents = cellstr(get(hObject,'String')) returns popupmenu_sample1Selector contents as cell array
0161 %        contents{get(hObject,'Value')} returns selected item from popupmenu_sample1Selector
0162     populateSampleList(hObject);
0163 
0164 
0165 function populateSampleList(hObject)    
0166     % get a list of all populations in the base workspace:
0167     vars = evalin('base','whos()');
0168     
0169     samples = [];
0170     for i=1:length(vars)
0171         if strcmp(vars(i).class,'sample')
0172             samples = [samples; {vars(i).name}]; %#ok<AGROW>
0173         end
0174     end
0175     
0176     
0177     
0178     % assign that list to the options in the pop up menu
0179     warning('off','MATLAB:hg:uicontrol:ParameterValuesMustBeValid');    
0180     set(hObject,'String',samples); 
0181 
0182 % --- Executes during object creation, after setting all properties.
0183 function popupmenu_sample1Selector_CreateFcn(hObject, eventdata, handles)
0184 % hObject    handle to popupmenu_sample1Selector (see GCBO)
0185 % eventdata  reserved - to be defined in a future version of MATLAB
0186 % handles    empty - handles not created until after all CreateFcns called
0187 
0188 % Hint: popupmenu controls usually have a white background on Windows.
0189 %       See ISPC and COMPUTER.
0190 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0191     set(hObject,'BackgroundColor','white');
0192 end
0193 
0194 
0195 % --- Executes on button press in pushbutton_refreshSample1List.
0196 function pushbutton_refreshSample1List_Callback(hObject, eventdata, handles)
0197 % hObject    handle to pushbutton_refreshSample1List (see GCBO)
0198 % eventdata  reserved - to be defined in a future version of MATLAB
0199 % handles    structure with handles and user data (see GUIDATA)
0200     populateSampleList(handles.popupmenu_sample1Selector);
0201 
0202 % --- If Enable == 'on', executes on mouse press in 5 pixel border.
0203 % --- Otherwise, executes on mouse press in 5 pixel border or over popupmenu_sample1Selector.
0204 function popupmenu_sample1Selector_ButtonDownFcn(hObject, eventdata, handles)
0205 % hObject    handle to popupmenu_sample1Selector (see GCBO)
0206 % eventdata  reserved - to be defined in a future version of MATLAB
0207 % handles    structure with handles and user data (see GUIDATA)
0208     populateSampleList(hObject);
0209 
0210 
0211 % --- Executes on selection change in popupmenu_sample1ColSelector.
0212 function popupmenu_sample1ColSelector_Callback(hObject, eventdata, handles)
0213 % hObject    handle to popupmenu_sample1ColSelector (see GCBO)
0214 % eventdata  reserved - to be defined in a future version of MATLAB
0215 % handles    structure with handles and user data (see GUIDATA)
0216     populateColumnList(hObject,handles.popupmenu_sample1Selector);
0217 
0218 % Hints: contents = cellstr(get(hObject,'String')) returns popupmenu_sample1ColSelector contents as cell array
0219 %        contents{get(hObject,'Value')} returns selected item from popupmenu_sample1ColSelector
0220 function populateColumnList(hObject,sampleSelector)    
0221     % get a list of all populations in the base workspace:
0222 
0223     create = true;
0224     
0225     % get the sample in the first list.
0226     sampleMenuHandle = sampleSelector;
0227     sampleName = getdfName(sampleMenuHandle,'sample 1');    
0228     
0229     if isempty(sampleName)
0230         create = false;
0231     end
0232     
0233     if create == true
0234         % add in all of the header names associated with that sample.
0235         tmpColNames = evalin('base',[sampleName,'.header']);
0236         
0237         % melt and refreeze cells
0238         colNames = {};
0239         
0240         for i=1:length(tmpColNames)
0241             colNames = [colNames ; tmpColNames{i}]; %#ok<AGROW>
0242         end
0243         
0244     
0245     % assign that list to the options in the pop up menu
0246         warning('off','MATLAB:hg:uicontrol:ParameterValuesMustBeValid');    
0247         set(hObject,'String',colNames);
0248     end
0249 
0250 % --- Executes during object creation, after setting all properties.
0251 function popupmenu_sample1ColSelector_CreateFcn(hObject, eventdata, handles)
0252 % hObject    handle to popupmenu_sample1ColSelector (see GCBO)
0253 % eventdata  reserved - to be defined in a future version of MATLAB
0254 % handles    empty - handles not created until after all CreateFcns called
0255 
0256 % Hint: popupmenu controls usually have a white background on Windows.
0257 %       See ISPC and COMPUTER.
0258 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0259     set(hObject,'BackgroundColor','white');
0260 end
0261 
0262 
0263 % --- Executes on button press in pushbutton_refreshsample1ColSelector.
0264 function pushbutton_refreshsample1ColSelector_Callback(hObject, eventdata, handles)
0265 % hObject    handle to pushbutton_refreshsample1ColSelector (see GCBO)
0266 % eventdata  reserved - to be defined in a future version of MATLAB
0267 % handles    structure with handles and user data (see GUIDATA)
0268     populateColumnList(handles.popupmenu_sample1ColSelector,handles.popupmenu_sample1Selector);
0269 
0270 
0271 % --- Executes on selection change in popupmenu_sample2Selector.
0272 function popupmenu_sample2Selector_Callback(hObject, eventdata, handles)
0273 % hObject    handle to popupmenu_sample2Selector (see GCBO)
0274 % eventdata  reserved - to be defined in a future version of MATLAB
0275 % handles    structure with handles and user data (see GUIDATA)
0276 
0277 % Hints: contents = cellstr(get(hObject,'String')) returns popupmenu_sample2Selector contents as cell array
0278 %        contents{get(hObject,'Value')} returns selected item from popupmenu_sample2Selector
0279     populateSampleList(hObject);
0280 
0281 
0282 % --- Executes during object creation, after setting all properties.
0283 function popupmenu_sample2Selector_CreateFcn(hObject, eventdata, handles)
0284 % hObject    handle to popupmenu_sample2Selector (see GCBO)
0285 % eventdata  reserved - to be defined in a future version of MATLAB
0286 % handles    empty - handles not created until after all CreateFcns called
0287 
0288 % Hint: popupmenu controls usually have a white background on Windows.
0289 %       See ISPC and COMPUTER.
0290 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0291     set(hObject,'BackgroundColor','white');
0292 end
0293 
0294 
0295 % --- Executes on button press in pushbutton_refreshSample2List.
0296 function pushbutton_refreshSample2List_Callback(hObject, eventdata, handles)
0297 % hObject    handle to pushbutton_refreshSample2List (see GCBO)
0298 % eventdata  reserved - to be defined in a future version of MATLAB
0299 % handles    structure with handles and user data (see GUIDATA)
0300     populateSampleList(handles.popupmenu_sample2Selector);
0301 
0302 % --- Executes on selection change in popupmenu_sample2ColSelector.
0303 function popupmenu_sample2ColSelector_Callback(hObject, eventdata, handles)
0304 % hObject    handle to popupmenu_sample2ColSelector (see GCBO)
0305 % eventdata  reserved - to be defined in a future version of MATLAB
0306 % handles    structure with handles and user data (see GUIDATA)
0307 
0308 % Hints: contents = cellstr(get(hObject,'String')) returns popupmenu_sample2ColSelector contents as cell array
0309 %        contents{get(hObject,'Value')} returns selected item from popupmenu_sample2ColSelector
0310     populateColumnList(hObject,handles.popupmenu_sample2Selector);
0311 
0312 
0313 % --- Executes during object creation, after setting all properties.
0314 function popupmenu_sample2ColSelector_CreateFcn(hObject, eventdata, handles)
0315 % hObject    handle to popupmenu_sample2ColSelector (see GCBO)
0316 % eventdata  reserved - to be defined in a future version of MATLAB
0317 % handles    empty - handles not created until after all CreateFcns called
0318 
0319 % Hint: popupmenu controls usually have a white background on Windows.
0320 %       See ISPC and COMPUTER.
0321 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0322     set(hObject,'BackgroundColor','white');
0323 end
0324 
0325 
0326 % --- Executes on button press in pushbutton_refreshsample2ColSelector.
0327 function pushbutton_refreshsample2ColSelector_Callback(hObject, eventdata, handles)
0328 % hObject    handle to pushbutton_refreshsample2ColSelector (see GCBO)
0329 % eventdata  reserved - to be defined in a future version of MATLAB
0330 % handles    structure with handles and user data (see GUIDATA)
0331     populateColumnList(handles.popupmenu_sample2ColSelector,handles.popupmenu_sample2Selector);
0332 
0333 
0334 % --- If Enable == 'on', executes on mouse press in 5 pixel border.
0335 % --- Otherwise, executes on mouse press in 5 pixel border or over popupmenu_sample1ColSelector.
0336 function popupmenu_sample1ColSelector_ButtonDownFcn(hObject, eventdata, handles)
0337 % hObject    handle to popupmenu_sample1ColSelector (see GCBO)
0338 % eventdata  reserved - to be defined in a future version of MATLAB
0339 % handles    structure with handles and user data (see GUIDATA)
0340     populateColumnList(hObject,handles.popupmenu_sample1Selector);
0341 
0342 
0343 % --- If Enable == 'on', executes on mouse press in 5 pixel border.
0344 % --- Otherwise, executes on mouse press in 5 pixel border or over popupmenu_sample2Selector.
0345 function popupmenu_sample2Selector_ButtonDownFcn(hObject, eventdata, handles)
0346 % hObject    handle to popupmenu_sample2Selector (see GCBO)
0347 % eventdata  reserved - to be defined in a future version of MATLAB
0348 % handles    structure with handles and user data (see GUIDATA)
0349     populateSampleList(hObject);
0350 
0351 
0352 % --- If Enable == 'on', executes on mouse press in 5 pixel border.
0353 % --- Otherwise, executes on mouse press in 5 pixel border or over popupmenu_sample2ColSelector.
0354 function popupmenu_sample2ColSelector_ButtonDownFcn(hObject, eventdata, handles)
0355 % hObject    handle to popupmenu_sample2ColSelector (see GCBO)
0356 % eventdata  reserved - to be defined in a future version of MATLAB
0357 % handles    structure with handles and user data (see GUIDATA)
0358     populateColumnList(hObject,handles.popupmenu_sample2Selector);
0359 
0360 
0361 
0362 function edit_desiredpval_Callback(hObject, eventdata, handles)
0363 % hObject    handle to edit_desiredpval (see GCBO)
0364 % eventdata  reserved - to be defined in a future version of MATLAB
0365 % handles    structure with handles and user data (see GUIDATA)
0366 
0367 % Hints: get(hObject,'String') returns contents of edit_desiredpval as text
0368 %        str2double(get(hObject,'String')) returns contents of edit_desiredpval as a double
0369     validate_desiredpval(handles);
0370 
0371 
0372 function flag = validate_desiredpval(handles)
0373     str = get(handles.edit_desiredpval,'String');
0374     
0375     errmsg = 'alpha must be a probability value between 0 and 1';
0376     errtitle = 'Invalid alpha!';
0377     
0378     flag = validateProbability(str,errmsg,errtitle);
0379 
0380 % --- Executes during object creation, after setting all properties.
0381 function edit_desiredpval_CreateFcn(hObject, eventdata, handles)
0382 % hObject    handle to edit_desiredpval (see GCBO)
0383 % eventdata  reserved - to be defined in a future version of MATLAB
0384 % handles    empty - handles not created until after all CreateFcns called
0385 
0386 % Hint: edit controls usually have a white background on Windows.
0387 %       See ISPC and COMPUTER.
0388 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0389     set(hObject,'BackgroundColor','white');
0390 end
0391 
0392 
0393 % --- Executes on selection change in popupmenu_desiredpvalCondition.
0394 function popupmenu_desiredpvalCondition_Callback(hObject, eventdata, handles)
0395 % hObject    handle to popupmenu_desiredpvalCondition (see GCBO)
0396 % eventdata  reserved - to be defined in a future version of MATLAB
0397 % handles    structure with handles and user data (see GUIDATA)
0398 
0399 % Hints: contents = cellstr(get(hObject,'String')) returns popupmenu_desiredpvalCondition contents as cell array
0400 %        contents{get(hObject,'Value')} returns selected item from popupmenu_desiredpvalCondition
0401 
0402 
0403 % --- Executes during object creation, after setting all properties.
0404 function popupmenu_desiredpvalCondition_CreateFcn(hObject, eventdata, handles)
0405 % hObject    handle to popupmenu_desiredpvalCondition (see GCBO)
0406 % eventdata  reserved - to be defined in a future version of MATLAB
0407 % handles    empty - handles not created until after all CreateFcns called
0408 
0409 % Hint: popupmenu controls usually have a white background on Windows.
0410 %       See ISPC and COMPUTER.
0411 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0412     set(hObject,'BackgroundColor','white');
0413 end
0414 
0415 
0416 % --- Executes on selection change in popupmenu_tails.
0417 function popupmenu_tails_Callback(hObject, eventdata, handles)
0418 % hObject    handle to popupmenu_tails (see GCBO)
0419 % eventdata  reserved - to be defined in a future version of MATLAB
0420 % handles    structure with handles and user data (see GUIDATA)
0421 
0422 % Hints: contents = cellstr(get(hObject,'String')) returns popupmenu_tails contents as cell array
0423 %        contents{get(hObject,'Value')} returns selected item from popupmenu_tails
0424 
0425 
0426 % --- Executes during object creation, after setting all properties.
0427 function popupmenu_tails_CreateFcn(hObject, eventdata, handles)
0428 % hObject    handle to popupmenu_tails (see GCBO)
0429 % eventdata  reserved - to be defined in a future version of MATLAB
0430 % handles    empty - handles not created until after all CreateFcns called
0431 
0432 % Hint: popupmenu controls usually have a white background on Windows.
0433 %       See ISPC and COMPUTER.
0434 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0435     set(hObject,'BackgroundColor','white');
0436 end
0437 
0438 
0439 % --- Executes on button press in pushbutton_create_ttest.
0440 function pushbutton_create_ttest_Callback(hObject, eventdata, handles)
0441 % hObject    handle to pushbutton_create_ttest (see GCBO)
0442 % eventdata  reserved - to be defined in a future version of MATLAB
0443 % handles    structure with handles and user data (see GUIDATA)
0444 
0445     type = getdfName(handles.popupmenu_type,'type');
0446 
0447     mainWindowHandle = sos_gui;
0448     mainWindowData = guidata(mainWindowHandle);
0449 
0450     sosObjName = getdfName(mainWindowData.popupmenu_SOSSelector,'SOS');
0451 
0452     if isempty(sosObjName) == 0
0453         % we have a valid SOS object to add the test to
0454         % validate all of the parameters for the test
0455         create = validate_name(handles);
0456         name = get(handles.edit_name,'String');
0457         
0458         if create == true
0459             sample1 = getdfName(handles.popupmenu_sample1Selector,'sample 1');
0460             
0461             if isempty(sample1) == 0
0462                 sample1Col = getdfName(handles.popupmenu_sample1ColSelector','sample 1 column');
0463                 
0464                 if isempty(sample1Col) == 0
0465                     sample2 = getdfName(handles.popupmenu_sample2Selector,'sample 2');
0466                     
0467                     if isempty(sample2) == 0
0468                         sample2Col = getdfName(handles.popupmenu_sample2ColSelector,'sample 2 column');
0469                         
0470                         if isempty(sample2Col) == 0
0471                             create  = validate_desiredpval(handles);
0472 
0473                             if create == true
0474                                 
0475                                create =  validate_desiredpval(handles);
0476                                
0477                                if create == true
0478                                     desiredpval = get(handles.edit_desiredpval,'String');
0479 
0480                                     create = validate_targVal(handles);
0481                                     
0482                                     if create == true
0483                                         targVal = get(handles.edit_targVal,'String');
0484 
0485                                         desiredpvalCondition = getdfName(handles.popupmenu_desiredpvalCondition,...
0486                                                             'desiredpvalCondition');
0487                                         %all of the other options are in drop-down
0488                                         %menus and as such necessarily will pass.
0489                                         %run the command.
0490 
0491                                         command = [sosObjName,'.addztest(',...
0492                                             '''name'',''',name,''',',...
0493                                             '''type'',''',type,''',',...
0494                                             '''sample1'',',sample1,',',...
0495                                             '''s1ColName'',''',sample1Col,''',',...
0496                                             '''sample2'',',sample2,',',...
0497                                             '''s2ColName'',''',sample2Col,''',',...
0498                                             '''targVal'',',targVal,''',',...
0499                                             '''desiredpvalCondition'',''',desiredpvalCondition,''',',...
0500                                             '''desiredpval'',',desiredpval,');',...
0501                                             ];
0502 
0503                                         verbosePrint(['Executing command: ','''',command,''''],'createMatchCorrelztest_Dialog_create');
0504                                         evalin('base',command);      
0505                                          close(handles.figure_createMatchCorrelztest_Dialog);
0506                                     end
0507                                end
0508                             end
0509                         end
0510                     end
0511                         
0512 
0513 
0514 
0515                 end
0516             end
0517         end
0518         
0519         
0520     end
0521 
0522 
0523 % --- Executes on selection change in popupmenu_type.
0524 function popupmenu_type_Callback(hObject, eventdata, handles)
0525 % hObject    handle to popupmenu_type (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 = cellstr(get(hObject,'String')) returns popupmenu_type contents as cell array
0530 %        contents{get(hObject,'Value')} returns selected item from popupmenu_type
0531 
0532 
0533 % --- Executes during object creation, after setting all properties.
0534 function popupmenu_type_CreateFcn(hObject, eventdata, handles)
0535 % hObject    handle to popupmenu_type (see GCBO)
0536 % eventdata  reserved - to be defined in a future version of MATLAB
0537 % handles    empty - handles not created until after all CreateFcns called
0538 
0539 % Hint: popupmenu controls usually have a white background on Windows.
0540 %       See ISPC and COMPUTER.
0541 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0542     set(hObject,'BackgroundColor','white');
0543 end
0544 
0545 
0546 
0547 function edit_targVal_Callback(hObject, eventdata, handles)
0548 % hObject    handle to edit_targVal (see GCBO)
0549 % eventdata  reserved - to be defined in a future version of MATLAB
0550 % handles    structure with handles and user data (see GUIDATA)
0551 
0552 % Hints: get(hObject,'String') returns contents of edit_targVal as text
0553 %        str2double(get(hObject,'String')) returns contents of edit_targVal as a double
0554     validate_targVal(handles);
0555     
0556     
0557 function flag = validate_targVal(handles)
0558      str = get(handles.edit_targVal,'String');
0559     
0560     errmsg = 'TargVal must be a number in range [-1,1]';
0561     errtitle = 'Invalid targVal!';
0562     
0563     flag = validateCorrel(str,errmsg,errtitle); 
0564 
0565 % --- Executes during object creation, after setting all properties.
0566 function edit_targVal_CreateFcn(hObject, eventdata, handles)
0567 % hObject    handle to edit_targVal (see GCBO)
0568 % eventdata  reserved - to be defined in a future version of MATLAB
0569 % handles    empty - handles not created until after all CreateFcns called
0570 
0571 % Hint: edit controls usually have a white background on Windows.
0572 %       See ISPC and COMPUTER.
0573 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0574     set(hObject,'BackgroundColor','white');
0575 end

Generated on Fri 27-Jan-2012 16:18:41 by m2html © 2005