Home > src > createMatchUniformkstest_Dialog.m

# createMatchUniformkstest_Dialog

## PURPOSE

- create uniformity ks-test dialog

## SYNOPSIS

function varargout = createMatchUniformkstest_Dialog(varargin)

## DESCRIPTION

     - create uniformity ks-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:

- getdfName - extracts a dataframe name selected in the GUI
- sos_gui - sos main GUI
- validatePositiveInteger - helper function to validate that a string represents a positive integer
- validateProbability - helper function to validate that a string represents a probability
- validateRealNumber - helper function to validate that a string represents a real number
- verbosePrint - master print function that regulates cmd line output based on verbosity flags

This function is called by:

- sos_gui - sos main GUI

## SUBFUNCTIONS

- function createMatchUniformkstest_Dialog_OpeningFcn(hObject, eventdata, handles, varargin)
- function varargout = createMatchUniformkstest_Dialog_OutputFcn(hObject, eventdata, handles)
- function edit_name_Callback(hObject, eventdata, handles)
- function flag = validate_name(handles)
- function edit_name_CreateFcn(hObject, eventdata, handles)
- function popupmenu_sample1Selector_Callback(hObject, eventdata, handles)
- function populateSampleList(hObject)
- function popupmenu_sample1Selector_CreateFcn(hObject, eventdata, handles)
- function pushbutton_refreshSample1List_Callback(hObject, eventdata, handles)
- function popupmenu_sample1Selector_ButtonDownFcn(hObject, eventdata, handles)
- function popupmenu_sample1ColSelector_Callback(hObject, eventdata, handles)
- function populateColumnList(hObject,sampleSelector)
- function popupmenu_sample1ColSelector_CreateFcn(hObject, eventdata, handles)
- function pushbutton_refreshsample1ColSelector_Callback(hObject, eventdata, handles)
- function popupmenu_sample2Selector_Callback(hObject, eventdata, handles)
- function popupmenu_sample2Selector_CreateFcn(hObject, eventdata, handles)
- function pushbutton_refreshSample2List_Callback(hObject, eventdata, handles)
- function popupmenu_sample2ColSelector_Callback(hObject, eventdata, handles)
- function popupmenu_sample2ColSelector_CreateFcn(hObject, eventdata, handles)
- function pushbutton_refreshsample2ColSelector_Callback(hObject, eventdata, handles)
- function popupmenu_sample1ColSelector_ButtonDownFcn(hObject, eventdata, handles)
- function popupmenu_sample2Selector_ButtonDownFcn(hObject, eventdata, handles)
- function popupmenu_sample2ColSelector_ButtonDownFcn(hObject, eventdata, handles)
- function edit_desiredpval_Callback(hObject, eventdata, handles)
- function flag = validate_desiredpval(handles)
- function edit_desiredpval_CreateFcn(hObject, eventdata, handles)
- function popupmenu_desiredpvalCondition_Callback(hObject, eventdata, handles)
- function popupmenu_desiredpvalCondition_CreateFcn(hObject, eventdata, handles)
- function popupmenu_tails_Callback(hObject, eventdata, handles)
- function popupmenu_tails_CreateFcn(hObject, eventdata, handles)
- function pushbutton_create_kstest_Callback(hObject, eventdata, handles)
- function popupmenu_type_Callback(hObject, eventdata, handles)
- function popupmenu_type_CreateFcn(hObject, eventdata, handles)
- function edit_nbin_Callback(hObject, eventdata, handles)
- function flag = validate_nbin(handles)
- function flag = validate_targValue(handles)
- function edit_nbin_CreateFcn(hObject, eventdata, handles)
- function popupmenu_pdSpreadSelector_Callback(hObject, eventdata, handles)
- function popupmenu_pdSpreadSelector_CreateFcn(hObject, eventdata, handles)

## SOURCE CODE

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