Home > src > createTwoSampleSoftDistanceConstraint_Dialog.m

# createTwoSampleSoftDistanceConstraint_Dialog

## PURPOSE

- create two sample soft distance constraint dialog

## SYNOPSIS

function varargout = createTwoSampleSoftDistanceConstraint_Dialog(varargin)

## DESCRIPTION

     - create two sample soft distance constraint 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
- 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 createTwoSampleSoftDistanceConstraint_Dialog_OpeningFcn(hObject, eventdata, handles, varargin)
- function varargout = createTwoSampleSoftDistanceConstraint_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_value_Callback(hObject, eventdata, handles)
- function edit_value_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_createTwoSampleSoftDistanceConstraint_Callback(hObject, eventdata, handles)
- function popupmenu_type_Callback(hObject, eventdata, handles)
- function popupmenu_type_CreateFcn(hObject, eventdata, handles)
- function popupmenu_fncSelector_Callback(hObject, eventdata, handles)
- function popupmenu_fncSelector_CreateFcn(hObject, eventdata, handles)
- function edit_weight_Callback(hObject, eventdata, handles)
- function flag = validate_weight(handles)
- function edit_weight_CreateFcn(hObject, eventdata, handles)
- function edit_exp_Callback(hObject, eventdata, handles)
- function flag = validate_exp(handles)
- function edit_exp_CreateFcn(hObject, eventdata, handles)
- function popupmenu_statSelector_Callback(hObject, eventdata, handles)
- function popupmenu_statSelector_CreateFcn(hObject, eventdata, handles)
- function popupmenu10_Callback(hObject, eventdata, handles)
- function popupmenu10_CreateFcn(hObject, eventdata, handles)
- function pushbutton7_Callback(hObject, eventdata, handles)
- function popupmenu11_Callback(hObject, eventdata, handles)
- function popupmenu11_CreateFcn(hObject, eventdata, handles)
- function pushbutton8_Callback(hObject, eventdata, handles)
- function popupmenu12_Callback(hObject, eventdata, handles)
- function popupmenu12_CreateFcn(hObject, eventdata, handles)
- function popupmenu_pairedSelector_Callback(hObject, eventdata, handles)
- function popupmenu_pairedSelector_CreateFcn(hObject, eventdata, handles)

## SOURCE CODE

    0001 % - create two sample soft distance constraint 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 function varargout = createTwoSampleSoftDistanceConstraint_Dialog(varargin)
    0025 % CREATETWOSAMPLESOFTDISTANCECONSTRAINT_DIALOG M-file for createTwoSampleSoftDistanceConstraint_Dialog.fig
    0026 %      CREATETWOSAMPLESOFTDISTANCECONSTRAINT_DIALOG, by itself, creates a new CREATETWOSAMPLESOFTDISTANCECONSTRAINT_DIALOG or raises the existing
    0027 %      singleton*.
    0028 %
    0029 %      H = CREATETWOSAMPLESOFTDISTANCECONSTRAINT_DIALOG returns the handle to a new CREATETWOSAMPLESOFTDISTANCECONSTRAINT_DIALOG or the handle to
    0030 %      the existing singleton*.
    0031 %
    0032 %      CREATETWOSAMPLESOFTDISTANCECONSTRAINT_DIALOG('CALLBACK',hObject,eventData,handles,...) calls the local
    0033 %      function named CALLBACK in CREATETWOSAMPLESOFTDISTANCECONSTRAINT_DIALOG.M with the given input arguments.
    0034 %
    0035 %      CREATETWOSAMPLESOFTDISTANCECONSTRAINT_DIALOG('Property','Value',...) creates a new CREATETWOSAMPLESOFTDISTANCECONSTRAINT_DIALOG or raises the
    0036 %      existing singleton*.  Starting from the left, property value pairs are
    0037 %      applied to the GUI before createTwoSampleSoftDistanceConstraint_Dialog_OpeningFcn gets called.  An
    0038 %      unrecognized property name or invalid value makes property application
    0039 %      stop.  All inputs are passed to createTwoSampleSoftDistanceConstraint_Dialog_OpeningFcn via varargin.
    0040 %
    0041 %      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
    0042 %      instance to run (singleton)".
    0043 %
    0044 % See also: GUIDE, GUIDATA, GUIHANDLES
    0045
    0046 % Edit the above text to modify the response to help createTwoSampleSoftDistanceConstraint_Dialog
    0047
    0048 % Last Modified by GUIDE v2.5 16-Sep-2010 20:58:22
    0049
    0050 % Begin initialization code - DO NOT EDIT
    0051 gui_Singleton = 1;
    0052 gui_State = struct('gui_Name',       mfilename, ...
    0053                    'gui_Singleton',  gui_Singleton, ...
    0054                    'gui_OpeningFcn', @createTwoSampleSoftDistanceConstraint_Dialog_OpeningFcn, ...
    0055                    'gui_OutputFcn',  @createTwoSampleSoftDistanceConstraint_Dialog_OutputFcn, ...
    0056                    'gui_LayoutFcn',  [] , ...
    0057                    'gui_Callback',   []);
    0058 if nargin && ischar(varargin{1})
    0059     gui_State.gui_Callback = str2func(varargin{1});
    0060 end
    0061
    0062 if nargout
    0063     [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
    0064 else
    0065     gui_mainfcn(gui_State, varargin{:});
    0066 end
    0067 % End initialization code - DO NOT EDIT
    0068
    0069
    0070 % --- Executes just before createTwoSampleSoftDistanceConstraint_Dialog is made visible.
    0071 function createTwoSampleSoftDistanceConstraint_Dialog_OpeningFcn(hObject, eventdata, handles, varargin)
    0072 % This function has no output args, see OutputFcn.
    0073 % hObject    handle to figure
    0074 % eventdata  reserved - to be defined in a future version of MATLAB
    0075 % handles    structure with handles and user data (see GUIDATA)
    0076 % varargin   command line arguments to createTwoSampleSoftDistanceConstraint_Dialog (see VARARGIN)
    0077
    0078 % Choose default command line output for createTwoSampleSoftDistanceConstraint_Dialog
    0079 handles.output = hObject;
    0080
    0081 % Update handles structure
    0082 guidata(hObject, handles);
    0083
    0084 % UIWAIT makes createTwoSampleSoftDistanceConstraint_Dialog wait for user response (see UIRESUME)
    0085 % uiwait(handles.figure_createTwoSampleSoftDistanceConstraint_Dialog);
    0086
    0087
    0088 % --- Outputs from this function are returned to the command line.
    0089 function varargout = createTwoSampleSoftDistanceConstraint_Dialog_OutputFcn(hObject, eventdata, handles)
    0090 % varargout  cell array for returning output args (see VARARGOUT);
    0091 % hObject    handle to figure
    0092 % eventdata  reserved - to be defined in a future version of MATLAB
    0093 % handles    structure with handles and user data (see GUIDATA)
    0094
    0095 % Get default command line output from handles structure
    0096 varargout{1} = handles.output;
    0097
    0098
    0099
    0100 function edit_name_Callback(hObject, eventdata, handles)
    0101 % hObject    handle to edit_name (see GCBO)
    0102 % eventdata  reserved - to be defined in a future version of MATLAB
    0103 % handles    structure with handles and user data (see GUIDATA)
    0104
    0105 % Hints: get(hObject,'String') returns contents of edit_name as text
    0106 %        str2double(get(hObject,'String')) returns contents of edit_name as a double
    0107     validate_name(handles);
    0108
    0109
    0110 function flag = validate_name(handles)
    0111
    0112     varName = get(handles.edit_name,'String');
    0113
    0114     %check to make sure that the name is a valid variable name:
    0115     valid = regexp(varName,'^[a-zA-Z]+\w*$', 'once');
    0116
    0117     if isempty(valid)
    0118         % name is not currently valid, tell the user.
    0119         msgbox('Only letters, numbers, and underscores are permitted in the name of the ttest object.  The first character must also be a letter.',...
    0120                 'Invalid name!');
    0121         flag = false;
    0122     else
    0123         % check to make sure that the new variable name doesn't already exist.
    0124         command = strcat('whos(''',varName,''')');
    0125         varExists = evalin('base',command);
    0126
    0127
    0128         % if a variable with this name already exists, warns the user
    0129         if isempty(varExists) == 0
    0130             msgbox('A variable with this name already exists and will be overridden if you continue',...
    0131                     'Variable name already in use!');
    0132         end
    0133
    0134         flag = true;
    0135     end
    0136
    0137
    0138
    0139 % --- Executes during object creation, after setting all properties.
    0140 function edit_name_CreateFcn(hObject, eventdata, handles)
    0141 % hObject    handle to edit_name (see GCBO)
    0142 % eventdata  reserved - to be defined in a future version of MATLAB
    0143 % handles    empty - handles not created until after all CreateFcns called
    0144
    0145 % Hint: edit controls usually have a white background on Windows.
    0146 %       See ISPC and COMPUTER.
    0147 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    0148     set(hObject,'BackgroundColor','white');
    0149 end
    0150
    0151
    0152 % --- Executes on selection change in popupmenu_sample1Selector.
    0153 function popupmenu_sample1Selector_Callback(hObject, eventdata, handles)
    0154 % hObject    handle to popupmenu_sample1Selector (see GCBO)
    0155 % eventdata  reserved - to be defined in a future version of MATLAB
    0156 % handles    structure with handles and user data (see GUIDATA)
    0157
    0158 % Hints: contents = cellstr(get(hObject,'String')) returns popupmenu_sample1Selector contents as cell array
    0159 %        contents{get(hObject,'Value')} returns selected item from popupmenu_sample1Selector
    0160     populateSampleList(hObject);
    0161
    0162
    0163 function populateSampleList(hObject)
    0164     % get a list of all populations in the base workspace:
    0165     vars = evalin('base','whos()');
    0166
    0167     samples = [];
    0168     for i=1:length(vars)
    0169         if strcmp(vars(i).class,'sample')
    0170             samples = [samples; {vars(i).name}]; %#ok<AGROW>
    0171         end
    0172     end
    0173
    0174
    0175
    0176     % assign that list to the options in the pop up menu
    0177     warning('off','MATLAB:hg:uicontrol:ParameterValuesMustBeValid');
    0178     set(hObject,'String',samples);
    0179
    0180 % --- Executes during object creation, after setting all properties.
    0181 function popupmenu_sample1Selector_CreateFcn(hObject, eventdata, handles)
    0182 % hObject    handle to popupmenu_sample1Selector (see GCBO)
    0183 % eventdata  reserved - to be defined in a future version of MATLAB
    0184 % handles    empty - handles not created until after all CreateFcns called
    0185
    0186 % Hint: popupmenu controls usually have a white background on Windows.
    0187 %       See ISPC and COMPUTER.
    0188 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    0189     set(hObject,'BackgroundColor','white');
    0190 end
    0191
    0192
    0193 % --- Executes on button press in pushbutton_refreshSample2List.
    0194 function pushbutton_refreshSample1List_Callback(hObject, eventdata, handles)
    0195 % hObject    handle to pushbutton_refreshSample2List (see GCBO)
    0196 % eventdata  reserved - to be defined in a future version of MATLAB
    0197 % handles    structure with handles and user data (see GUIDATA)
    0198     populateSampleList(handles.popupmenu_sample1Selector);
    0199
    0200 % --- If Enable == 'on', executes on mouse press in 5 pixel border.
    0201 % --- Otherwise, executes on mouse press in 5 pixel border or over popupmenu_sample1Selector.
    0202 function popupmenu_sample1Selector_ButtonDownFcn(hObject, eventdata, handles)
    0203 % hObject    handle to popupmenu_sample1Selector (see GCBO)
    0204 % eventdata  reserved - to be defined in a future version of MATLAB
    0205 % handles    structure with handles and user data (see GUIDATA)
    0206     populateSampleList(hObject);
    0207
    0208
    0209 % --- Executes on selection change in popupmenu_sample2ColSelector.
    0210 function popupmenu_sample1ColSelector_Callback(hObject, eventdata, handles)
    0211 % hObject    handle to popupmenu_sample2ColSelector (see GCBO)
    0212 % eventdata  reserved - to be defined in a future version of MATLAB
    0213 % handles    structure with handles and user data (see GUIDATA)
    0214     populateColumnList(hObject,handles.popupmenu_sample1Selector);
    0215
    0216 % Hints: contents = cellstr(get(hObject,'String')) returns popupmenu_sample2ColSelector contents as cell array
    0217 %        contents{get(hObject,'Value')} returns selected item from popupmenu_sample2ColSelector
    0218 function populateColumnList(hObject,sampleSelector)
    0219     % get a list of all populations in the base workspace:
    0220
    0221     create = true;
    0222
    0223     % get the sample in the first list.
    0224     sampleMenuHandle = sampleSelector;
    0225     sampleName = getdfName(sampleMenuHandle,'sample 1');
    0226
    0227     if isempty(sampleName)
    0228         create = false;
    0229     end
    0230
    0231     if create == true
    0232         % add in all of the header names associated with that sample.
    0233         tmpColNames = evalin('base',[sampleName,'.header']);
    0234
    0235         % melt and refreeze cells
    0236         colNames = {};
    0237
    0238         for i=1:length(tmpColNames)
    0239             colNames = [colNames ; tmpColNames{i}]; %#ok<AGROW>
    0240         end
    0241
    0242
    0243     % assign that list to the options in the pop up menu
    0244         warning('off','MATLAB:hg:uicontrol:ParameterValuesMustBeValid');
    0245         set(hObject,'String',colNames);
    0246     end
    0247
    0248 % --- Executes during object creation, after setting all properties.
    0249 function popupmenu_sample1ColSelector_CreateFcn(hObject, eventdata, handles)
    0250 % hObject    handle to popupmenu_sample2ColSelector (see GCBO)
    0251 % eventdata  reserved - to be defined in a future version of MATLAB
    0252 % handles    empty - handles not created until after all CreateFcns called
    0253
    0254 % Hint: popupmenu controls usually have a white background on Windows.
    0255 %       See ISPC and COMPUTER.
    0256 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    0257     set(hObject,'BackgroundColor','white');
    0258 end
    0259
    0260
    0261 % --- Executes on button press in pushbutton_refreshsample1ColSelector.
    0262 function pushbutton_refreshsample1ColSelector_Callback(hObject, eventdata, handles)
    0263 % hObject    handle to pushbutton_refreshsample1ColSelector (see GCBO)
    0264 % eventdata  reserved - to be defined in a future version of MATLAB
    0265 % handles    structure with handles and user data (see GUIDATA)
    0266     populateColumnList(handles.popupmenu_sample1ColSelector,handles.popupmenu_sample1Selector);
    0267
    0268
    0269 % --- Executes on selection change in popupmenu_sample2Selector.
    0270 function popupmenu_sample2Selector_Callback(hObject, eventdata, handles)
    0271 % hObject    handle to popupmenu_sample2Selector (see GCBO)
    0272 % eventdata  reserved - to be defined in a future version of MATLAB
    0273 % handles    structure with handles and user data (see GUIDATA)
    0274
    0275 % Hints: contents = cellstr(get(hObject,'String')) returns popupmenu_sample2Selector contents as cell array
    0276 %        contents{get(hObject,'Value')} returns selected item from popupmenu_sample2Selector
    0277     populateSampleList(hObject);
    0278
    0279
    0280 % --- Executes during object creation, after setting all properties.
    0281 function popupmenu_sample2Selector_CreateFcn(hObject, eventdata, handles)
    0282 % hObject    handle to popupmenu_sample2Selector (see GCBO)
    0283 % eventdata  reserved - to be defined in a future version of MATLAB
    0284 % handles    empty - handles not created until after all CreateFcns called
    0285
    0286 % Hint: popupmenu controls usually have a white background on Windows.
    0287 %       See ISPC and COMPUTER.
    0288 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    0289     set(hObject,'BackgroundColor','white');
    0290 end
    0291
    0292
    0293 % --- Executes on button press in pushbutton_refreshSample2List.
    0294 function pushbutton_refreshSample2List_Callback(hObject, eventdata, handles)
    0295 % hObject    handle to pushbutton_refreshSample2List (see GCBO)
    0296 % eventdata  reserved - to be defined in a future version of MATLAB
    0297 % handles    structure with handles and user data (see GUIDATA)
    0298     populateSampleList(handles.popupmenu_sample2Selector);
    0299
    0300 % --- Executes on selection change in popupmenu_sample2ColSelector.
    0301 function popupmenu_sample2ColSelector_Callback(hObject, eventdata, handles)
    0302 % hObject    handle to popupmenu_sample2ColSelector (see GCBO)
    0303 % eventdata  reserved - to be defined in a future version of MATLAB
    0304 % handles    structure with handles and user data (see GUIDATA)
    0305
    0306 % Hints: contents = cellstr(get(hObject,'String')) returns popupmenu_sample2ColSelector contents as cell array
    0307 %        contents{get(hObject,'Value')} returns selected item from popupmenu_sample2ColSelector
    0308     populateColumnList(hObject,handles.popupmenu_sample2Selector);
    0309
    0310
    0311 % --- Executes during object creation, after setting all properties.
    0312 function popupmenu_sample2ColSelector_CreateFcn(hObject, eventdata, handles)
    0313 % hObject    handle to popupmenu_sample2ColSelector (see GCBO)
    0314 % eventdata  reserved - to be defined in a future version of MATLAB
    0315 % handles    empty - handles not created until after all CreateFcns called
    0316
    0317 % Hint: popupmenu controls usually have a white background on Windows.
    0318 %       See ISPC and COMPUTER.
    0319 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    0320     set(hObject,'BackgroundColor','white');
    0321 end
    0322
    0323
    0324 % --- Executes on button press in pushbutton_refreshsample2ColSelector.
    0325 function pushbutton_refreshsample2ColSelector_Callback(hObject, eventdata, handles)
    0326 % hObject    handle to pushbutton_refreshsample2ColSelector (see GCBO)
    0327 % eventdata  reserved - to be defined in a future version of MATLAB
    0328 % handles    structure with handles and user data (see GUIDATA)
    0329     populateColumnList(handles.popupmenu_sample2ColSelector,handles.popupmenu_sample2Selector);
    0330
    0331
    0332 % --- If Enable == 'on', executes on mouse press in 5 pixel border.
    0333 % --- Otherwise, executes on mouse press in 5 pixel border or over popupmenu_sample2ColSelector.
    0334 function popupmenu_sample1ColSelector_ButtonDownFcn(hObject, eventdata, handles)
    0335 % hObject    handle to popupmenu_sample2ColSelector (see GCBO)
    0336 % eventdata  reserved - to be defined in a future version of MATLAB
    0337 % handles    structure with handles and user data (see GUIDATA)
    0338     populateColumnList(hObject,handles.popupmenu_sample1Selector);
    0339
    0340
    0341 % --- If Enable == 'on', executes on mouse press in 5 pixel border.
    0342 % --- Otherwise, executes on mouse press in 5 pixel border or over popupmenu_sample2Selector.
    0343 function popupmenu_sample2Selector_ButtonDownFcn(hObject, eventdata, handles)
    0344 % hObject    handle to popupmenu_sample2Selector (see GCBO)
    0345 % eventdata  reserved - to be defined in a future version of MATLAB
    0346 % handles    structure with handles and user data (see GUIDATA)
    0347     populateSampleList(hObject);
    0348
    0349
    0350 % --- If Enable == 'on', executes on mouse press in 5 pixel border.
    0351 % --- Otherwise, executes on mouse press in 5 pixel border or over popupmenu_sample2ColSelector.
    0352 function popupmenu_sample2ColSelector_ButtonDownFcn(hObject, eventdata, handles)
    0353 % hObject    handle to popupmenu_sample2ColSelector (see GCBO)
    0354 % eventdata  reserved - to be defined in a future version of MATLAB
    0355 % handles    structure with handles and user data (see GUIDATA)
    0356     populateColumnList(hObject,handles.popupmenu_sample2Selector);
    0357
    0358
    0359
    0360 function edit_value_Callback(hObject, eventdata, handles)
    0361 % hObject    handle to edit_value (see GCBO)
    0362 % eventdata  reserved - to be defined in a future version of MATLAB
    0363 % handles    structure with handles and user data (see GUIDATA)
    0364
    0365 % Hints: get(hObject,'String') returns contents of edit_value as text
    0366 %        str2double(get(hObject,'String')) returns contents of edit_value as a double
    0367     validate_value(handles);
    0368
    0369
    0370
    0371 % --- Executes during object creation, after setting all properties.
    0372 function edit_value_CreateFcn(hObject, eventdata, handles)
    0373 % hObject    handle to edit_value (see GCBO)
    0374 % eventdata  reserved - to be defined in a future version of MATLAB
    0375 % handles    empty - handles not created until after all CreateFcns called
    0376
    0377 % Hint: edit controls usually have a white background on Windows.
    0378 %       See ISPC and COMPUTER.
    0379 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    0380     set(hObject,'BackgroundColor','white');
    0381 end
    0382
    0383
    0384 % --- Executes on selection change in popupmenu_desiredpvalCondition.
    0385 function popupmenu_desiredpvalCondition_Callback(hObject, eventdata, handles)
    0386 % hObject    handle to popupmenu_desiredpvalCondition (see GCBO)
    0387 % eventdata  reserved - to be defined in a future version of MATLAB
    0388 % handles    structure with handles and user data (see GUIDATA)
    0389
    0390 % Hints: contents = cellstr(get(hObject,'String')) returns popupmenu_desiredpvalCondition contents as cell array
    0391 %        contents{get(hObject,'Value')} returns selected item from popupmenu_desiredpvalCondition
    0392
    0393
    0394 % --- Executes during object creation, after setting all properties.
    0395 function popupmenu_desiredpvalCondition_CreateFcn(hObject, eventdata, handles)
    0396 % hObject    handle to popupmenu_desiredpvalCondition (see GCBO)
    0397 % eventdata  reserved - to be defined in a future version of MATLAB
    0398 % handles    empty - handles not created until after all CreateFcns called
    0399
    0400 % Hint: popupmenu controls usually have a white background on Windows.
    0401 %       See ISPC and COMPUTER.
    0402 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    0403     set(hObject,'BackgroundColor','white');
    0404 end
    0405
    0406
    0407 % --- Executes on selection change in popupmenu_tails.
    0408 function popupmenu_tails_Callback(hObject, eventdata, handles)
    0409 % hObject    handle to popupmenu_tails (see GCBO)
    0410 % eventdata  reserved - to be defined in a future version of MATLAB
    0411 % handles    structure with handles and user data (see GUIDATA)
    0412
    0413 % Hints: contents = cellstr(get(hObject,'String')) returns popupmenu_tails contents as cell array
    0414 %        contents{get(hObject,'Value')} returns selected item from popupmenu_tails
    0415
    0416
    0417 % --- Executes during object creation, after setting all properties.
    0418 function popupmenu_tails_CreateFcn(hObject, eventdata, handles)
    0419 % hObject    handle to popupmenu_tails (see GCBO)
    0420 % eventdata  reserved - to be defined in a future version of MATLAB
    0421 % handles    empty - handles not created until after all CreateFcns called
    0422
    0423 % Hint: popupmenu controls usually have a white background on Windows.
    0424 %       See ISPC and COMPUTER.
    0425 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    0426     set(hObject,'BackgroundColor','white');
    0427 end
    0428
    0429
    0430 % --- Executes on button press in pushbutton_createTwoSampleSoftDistanceConstraint.
    0431 function pushbutton_createTwoSampleSoftDistanceConstraint_Callback(hObject, eventdata, handles)
    0432 % hObject    handle to pushbutton_createTwoSampleSoftDistanceConstraint (see GCBO)
    0433 % eventdata  reserved - to be defined in a future version of MATLAB
    0434 % handles    structure with handles and user data (see GUIDATA)
    0435
    0436     type = getdfName(handles.popupmenu_type,'type');
    0437
    0438     mainWindowHandle = sos_gui;
    0439     mainWindowData = guidata(mainWindowHandle);
    0440
    0441     sosObjName = getdfName(mainWindowData.popupmenu_SOSSelector,'SOS');
    0442
    0443     if isempty(sosObjName) == 0
    0444         % we have a valid SOS object to add the test to
    0445         % validate all of the parameters for the test
    0446         create = validate_name(handles);
    0447         name = get(handles.edit_name,'String');
    0448
    0449         if create == true
    0450             sample1 = getdfName(handles.popupmenu_sample1Selector,'sample 1');
    0451
    0452             if isempty(sample1) == 0
    0453                 sample1Col = getdfName(handles.popupmenu_sample1ColSelector','sample 1 column');
    0454
    0455                 if isempty(sample1Col) == 0
    0456
    0457                    sample2 = getdfName(handles.popupmenu_sample2Selector,'sample 2');
    0458
    0459                    if isempty(sample2) == 0
    0460                        sample2Col = getdfName(handles.popupmenu_sample2ColSelector','sample 2 column');
    0461
    0462                        if isempty(sample2Col) == 0
    0463
    0464                             % check weight
    0465                             create = validate_weight(handles);
    0466                             if create == true
    0467                                 weight = get(handles.edit_weight,'String');
    0468
    0469                                 create = validate_exp(handles);
    0470                                 if create == true
    0471                                     exp = get (handles.edit_exp,'String');
    0472
    0473                                         %all functions passed, retrieve the
    0474                                         %hard-coded popup menu data
    0475
    0476                                         fnc = getdfName(handles.popupmenu_fncSelector,...
    0477                                                         'fnc');
    0478                                         stat = getdfName(handles.popupmenu_statSelector,...
    0479                                                         'stat');
    0480                                         paired = getdfName(handles.popupmenu_pairedSelector,...
    0481                                                 'paired');
    0482
    0483                                         %all of the other options are in drop-down
    0484                                         %menus and as such necessarily will pass.
    0485                                         %run the command.
    0486
    0487                                         command = [name,'=',sosObjName,'.addConstraint(',...
    0488                                             '''name'',''',name,''',',...
    0489                                             '''constraintType'',''',type,''',',...
    0490                                             '''stat'',''',stat,''',',...
    0491                                             '''fnc'',''',fnc,''',',...
    0492                                             '''sample1'',',sample1,',',...
    0493                                             '''s1ColName'',''',sample1Col,''',',...
    0494                                             '''sample2'',',sample2,',',...
    0495                                             '''s2ColName'',''',sample2Col,''',',...
    0496                                             '''paired'',',paired,',',...
    0497                                             '''weight'',',weight,','...
    0498                                             '''exponent'',',exp,');',...
    0499                                             ];
    0500
    0501                                         verbosePrint(['Executing command: ','''',command,''''],'createTwoSampleSoftDistanceConstraint_Dialog_create');
    0502                                         evalin('base',command);
    0503                                         close(handles.figure_createTwoSampleSoftDistanceConstraint_Dialog);
    0504                                 end
    0505                             end
    0506                        end
    0507                    end
    0508                 end
    0509             end
    0510         end
    0511     end
    0512
    0513
    0514 % --- Executes on selection change in popupmenu_type.
    0515 function popupmenu_type_Callback(hObject, eventdata, handles)
    0516 % hObject    handle to popupmenu_type (see GCBO)
    0517 % eventdata  reserved - to be defined in a future version of MATLAB
    0518 % handles    structure with handles and user data (see GUIDATA)
    0519
    0520 % Hints: contents = cellstr(get(hObject,'String')) returns popupmenu_type contents as cell array
    0521 %        contents{get(hObject,'Value')} returns selected item from popupmenu_type
    0522
    0523
    0524 % --- Executes during object creation, after setting all properties.
    0525 function popupmenu_type_CreateFcn(hObject, eventdata, handles)
    0526 % hObject    handle to popupmenu_type (see GCBO)
    0527 % eventdata  reserved - to be defined in a future version of MATLAB
    0528 % handles    empty - handles not created until after all CreateFcns called
    0529
    0530 % Hint: popupmenu controls usually have a white background on Windows.
    0531 %       See ISPC and COMPUTER.
    0532 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    0533     set(hObject,'BackgroundColor','white');
    0534 end
    0535
    0536
    0537 % --- Executes on selection change in popupmenu_fncSelector.
    0538 function popupmenu_fncSelector_Callback(hObject, eventdata, handles)
    0539 % hObject    handle to popupmenu_fncSelector (see GCBO)
    0540 % eventdata  reserved - to be defined in a future version of MATLAB
    0541 % handles    structure with handles and user data (see GUIDATA)
    0542
    0543 % Hints: contents = cellstr(get(hObject,'String')) returns popupmenu_fncSelector contents as cell array
    0544 %        contents{get(hObject,'Value')} returns selected item from popupmenu_fncSelector
    0545
    0546
    0547 % --- Executes during object creation, after setting all properties.
    0548 function popupmenu_fncSelector_CreateFcn(hObject, eventdata, handles)
    0549 % hObject    handle to popupmenu_fncSelector (see GCBO)
    0550 % eventdata  reserved - to be defined in a future version of MATLAB
    0551 % handles    empty - handles not created until after all CreateFcns called
    0552
    0553 % Hint: popupmenu controls usually have a white background on Windows.
    0554 %       See ISPC and COMPUTER.
    0555 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    0556     set(hObject,'BackgroundColor','white');
    0557 end
    0558
    0559
    0560
    0561 function edit_weight_Callback(hObject, eventdata, handles)
    0562 % hObject    handle to edit_weight (see GCBO)
    0563 % eventdata  reserved - to be defined in a future version of MATLAB
    0564 % handles    structure with handles and user data (see GUIDATA)
    0565
    0566 % Hints: get(hObject,'String') returns contents of edit_weight as text
    0567 %        str2double(get(hObject,'String')) returns contents of edit_weight as a double
    0568     validate_weight(handles);
    0569
    0570
    0571 function flag = validate_weight(handles)
    0572      str = get(handles.edit_weight,'String');
    0573
    0574     errmsg = 'Weight must be a number';
    0575     errtitle = 'Invalid weight!';
    0576
    0577     flag = validateRealNumber(str,errmsg,errtitle);
    0578
    0579 % --- Executes during object creation, after setting all properties.
    0580 function edit_weight_CreateFcn(hObject, eventdata, handles)
    0581 % hObject    handle to edit_weight (see GCBO)
    0582 % eventdata  reserved - to be defined in a future version of MATLAB
    0583 % handles    empty - handles not created until after all CreateFcns called
    0584
    0585 % Hint: edit controls usually have a white background on Windows.
    0586 %       See ISPC and COMPUTER.
    0587 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    0588     set(hObject,'BackgroundColor','white');
    0589 end
    0590
    0591
    0592
    0593 function edit_exp_Callback(hObject, eventdata, handles)
    0594 % hObject    handle to edit_exp (see GCBO)
    0595 % eventdata  reserved - to be defined in a future version of MATLAB
    0596 % handles    structure with handles and user data (see GUIDATA)
    0597
    0598 % Hints: get(hObject,'String') returns contents of edit_exp as text
    0599 %        str2double(get(hObject,'String')) returns contents of edit_exp as a double
    0600     validate_exp(handles);
    0601
    0602
    0603 function flag = validate_exp(handles)
    0604      str = get(handles.edit_exp,'String');
    0605
    0606     errmsg = 'Exponent must be a number';
    0607     errtitle = 'Invalid exponent!';
    0608
    0609     flag = validateRealNumber(str,errmsg,errtitle);
    0610
    0611 % --- Executes during object creation, after setting all properties.
    0612 function edit_exp_CreateFcn(hObject, eventdata, handles)
    0613 % hObject    handle to edit_exp (see GCBO)
    0614 % eventdata  reserved - to be defined in a future version of MATLAB
    0615 % handles    empty - handles not created until after all CreateFcns called
    0616
    0617 % Hint: edit controls usually have a white background on Windows.
    0618 %       See ISPC and COMPUTER.
    0619 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    0620     set(hObject,'BackgroundColor','white');
    0621 end
    0622
    0623
    0624 % --- Executes on selection change in popupmenu_statSelector.
    0625 function popupmenu_statSelector_Callback(hObject, eventdata, handles)
    0626 % hObject    handle to popupmenu_statSelector (see GCBO)
    0627 % eventdata  reserved - to be defined in a future version of MATLAB
    0628 % handles    structure with handles and user data (see GUIDATA)
    0629
    0630 % Hints: contents = cellstr(get(hObject,'String')) returns popupmenu_statSelector contents as cell array
    0631 %        contents{get(hObject,'Value')} returns selected item from popupmenu_statSelector
    0632
    0633
    0634 % --- Executes during object creation, after setting all properties.
    0635 function popupmenu_statSelector_CreateFcn(hObject, eventdata, handles)
    0636 % hObject    handle to popupmenu_statSelector (see GCBO)
    0637 % eventdata  reserved - to be defined in a future version of MATLAB
    0638 % handles    empty - handles not created until after all CreateFcns called
    0639
    0640 % Hint: popupmenu controls usually have a white background on Windows.
    0641 %       See ISPC and COMPUTER.
    0642 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    0643     set(hObject,'BackgroundColor','white');
    0644 end
    0645
    0646
    0647 % --- Executes on selection change in popupmenu_sample2Selector.
    0648 function popupmenu10_Callback(hObject, eventdata, handles)
    0649 % hObject    handle to popupmenu_sample2Selector (see GCBO)
    0650 % eventdata  reserved - to be defined in a future version of MATLAB
    0651 % handles    structure with handles and user data (see GUIDATA)
    0652
    0653 % Hints: contents = cellstr(get(hObject,'String')) returns popupmenu_sample2Selector contents as cell array
    0654 %        contents{get(hObject,'Value')} returns selected item from popupmenu_sample2Selector
    0655
    0656
    0657 % --- Executes during object creation, after setting all properties.
    0658 function popupmenu10_CreateFcn(hObject, eventdata, handles)
    0659 % hObject    handle to popupmenu_sample2Selector (see GCBO)
    0660 % eventdata  reserved - to be defined in a future version of MATLAB
    0661 % handles    empty - handles not created until after all CreateFcns called
    0662
    0663 % Hint: popupmenu controls usually have a white background on Windows.
    0664 %       See ISPC and COMPUTER.
    0665 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    0666     set(hObject,'BackgroundColor','white');
    0667 end
    0668
    0669
    0670 % --- Executes on button press in pushbutton_refreshSample2List.
    0671 function pushbutton7_Callback(hObject, eventdata, handles)
    0672 % hObject    handle to pushbutton_refreshSample2List (see GCBO)
    0673 % eventdata  reserved - to be defined in a future version of MATLAB
    0674 % handles    structure with handles and user data (see GUIDATA)
    0675
    0676
    0677 % --- Executes on selection change in popupmenu_sample2ColSelector.
    0678 function popupmenu11_Callback(hObject, eventdata, handles)
    0679 % hObject    handle to popupmenu_sample2ColSelector (see GCBO)
    0680 % eventdata  reserved - to be defined in a future version of MATLAB
    0681 % handles    structure with handles and user data (see GUIDATA)
    0682
    0683 % Hints: contents = cellstr(get(hObject,'String')) returns popupmenu_sample2ColSelector contents as cell array
    0684 %        contents{get(hObject,'Value')} returns selected item from popupmenu_sample2ColSelector
    0685
    0686
    0687 % --- Executes during object creation, after setting all properties.
    0688 function popupmenu11_CreateFcn(hObject, eventdata, handles)
    0689 % hObject    handle to popupmenu_sample2ColSelector (see GCBO)
    0690 % eventdata  reserved - to be defined in a future version of MATLAB
    0691 % handles    empty - handles not created until after all CreateFcns called
    0692
    0693 % Hint: popupmenu controls usually have a white background on Windows.
    0694 %       See ISPC and COMPUTER.
    0695 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    0696     set(hObject,'BackgroundColor','white');
    0697 end
    0698
    0699
    0700 % --- Executes on button press in pushbutton_refreshsample2ColSelector.
    0701 function pushbutton8_Callback(hObject, eventdata, handles)
    0702 % hObject    handle to pushbutton_refreshsample2ColSelector (see GCBO)
    0703 % eventdata  reserved - to be defined in a future version of MATLAB
    0704 % handles    structure with handles and user data (see GUIDATA)
    0705
    0706
    0707 % --- Executes on selection change in popupmenu12.
    0708 function popupmenu12_Callback(hObject, eventdata, handles)
    0709 % hObject    handle to popupmenu12 (see GCBO)
    0710 % eventdata  reserved - to be defined in a future version of MATLAB
    0711 % handles    structure with handles and user data (see GUIDATA)
    0712
    0713 % Hints: contents = cellstr(get(hObject,'String')) returns popupmenu12 contents as cell array
    0714 %        contents{get(hObject,'Value')} returns selected item from popupmenu12
    0715
    0716
    0717 % --- Executes during object creation, after setting all properties.
    0718 function popupmenu12_CreateFcn(hObject, eventdata, handles)
    0719 % hObject    handle to popupmenu12 (see GCBO)
    0720 % eventdata  reserved - to be defined in a future version of MATLAB
    0721 % handles    empty - handles not created until after all CreateFcns called
    0722
    0723 % Hint: popupmenu controls usually have a white background on Windows.
    0724 %       See ISPC and COMPUTER.
    0725 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    0726     set(hObject,'BackgroundColor','white');
    0727 end
    0728
    0729
    0730 % --- Executes on selection change in popupmenu_pairedSelector.
    0731 function popupmenu_pairedSelector_Callback(hObject, eventdata, handles)
    0732 % hObject    handle to popupmenu_pairedSelector (see GCBO)
    0733 % eventdata  reserved - to be defined in a future version of MATLAB
    0734 % handles    structure with handles and user data (see GUIDATA)
    0735
    0736 % Hints: contents = cellstr(get(hObject,'String')) returns popupmenu_pairedSelector contents as cell array
    0737 %        contents{get(hObject,'Value')} returns selected item from popupmenu_pairedSelector
    0738
    0739
    0740 % --- Executes during object creation, after setting all properties.
    0741 function popupmenu_pairedSelector_CreateFcn(hObject, eventdata, handles)
    0742 % hObject    handle to popupmenu_pairedSelector (see GCBO)
    0743 % eventdata  reserved - to be defined in a future version of MATLAB
    0744 % handles    empty - handles not created until after all CreateFcns called
    0745
    0746 % Hint: popupmenu controls usually have a white background on Windows.
    0747 %       See ISPC and COMPUTER.
    0748 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    0749     set(hObject,'BackgroundColor','white');
    0750 end