- create single sample t-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.
0001 % - create single sample t-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 function varargout = createsinglesamplettest_Dialog(varargin) 0025 % CREATESINGLESAMPLETTEST_DIALOG M-file for createsinglesamplettest_Dialog.fig 0026 % CREATESINGLESAMPLETTEST_DIALOG, by itself, creates a new CREATESINGLESAMPLETTEST_DIALOG or raises the existing 0027 % singleton*. 0028 % 0029 % H = CREATESINGLESAMPLETTEST_DIALOG returns the handle to a new CREATESINGLESAMPLETTEST_DIALOG or the handle to 0030 % the existing singleton*. 0031 % 0032 % CREATESINGLESAMPLETTEST_DIALOG('CALLBACK',hObject,eventData,handles,...) calls the local 0033 % function named CALLBACK in CREATESINGLESAMPLETTEST_DIALOG.M with the given input arguments. 0034 % 0035 % CREATESINGLESAMPLETTEST_DIALOG('Property','Value',...) creates a new CREATESINGLESAMPLETTEST_DIALOG or raises the 0036 % existing singleton*. Starting from the left, property value pairs are 0037 % applied to the GUI before createsinglesamplettest_Dialog_OpeningFcn gets called. An 0038 % unrecognized property name or invalid value makes property application 0039 % stop. All inputs are passed to createsinglesamplettest_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 createsinglesamplettest_Dialog 0047 0048 % Last Modified by GUIDE v2.5 15-Sep-2010 18:19:47 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', @createsinglesamplettest_Dialog_OpeningFcn, ... 0055 'gui_OutputFcn', @createsinglesamplettest_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 createsinglesamplettest_Dialog is made visible. 0071 function createsinglesamplettest_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 createsinglesamplettest_Dialog (see VARARGIN) 0077 0078 % Choose default command line output for createsinglesamplettest_Dialog 0079 handles.output = hObject; 0080 0081 % Update handles structure 0082 guidata(hObject, handles); 0083 0084 % UIWAIT makes createsinglesamplettest_Dialog wait for user response (see UIRESUME) 0085 % uiwait(handles.figure_createsinglesamplettest_Dialog); 0086 0087 0088 % --- Outputs from this function are returned to the command line. 0089 function varargout = createsinglesamplettest_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_refreshSample1List. 0194 function pushbutton_refreshSample1List_Callback(hObject, eventdata, handles) 0195 % hObject handle to pushbutton_refreshSample1List (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_sample1ColSelector. 0210 function popupmenu_sample1ColSelector_Callback(hObject, eventdata, handles) 0211 % hObject handle to popupmenu_sample1ColSelector (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_sample1ColSelector contents as cell array 0217 % contents{get(hObject,'Value')} returns selected item from popupmenu_sample1ColSelector 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_sample1ColSelector (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_sample1ColSelector. 0334 function popupmenu_sample1ColSelector_ButtonDownFcn(hObject, eventdata, handles) 0335 % hObject handle to popupmenu_sample1ColSelector (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_desiredpval_Callback(hObject, eventdata, handles) 0361 % hObject handle to edit_desiredpval (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_desiredpval as text 0366 % str2double(get(hObject,'String')) returns contents of edit_desiredpval as a double 0367 validate_desiredpval(handles); 0368 0369 0370 function flag = validate_desiredpval(handles) 0371 str = get(handles.edit_desiredpval,'String'); 0372 0373 errmsg = 'alpha must be a probability value between 0 and 1'; 0374 errtitle = 'Invalid alpha!'; 0375 0376 flag = validateProbability(str,errmsg,errtitle); 0377 0378 % --- Executes during object creation, after setting all properties. 0379 function edit_desiredpval_CreateFcn(hObject, eventdata, handles) 0380 % hObject handle to edit_desiredpval (see GCBO) 0381 % eventdata reserved - to be defined in a future version of MATLAB 0382 % handles empty - handles not created until after all CreateFcns called 0383 0384 % Hint: edit controls usually have a white background on Windows. 0385 % See ISPC and COMPUTER. 0386 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) 0387 set(hObject,'BackgroundColor','white'); 0388 end 0389 0390 0391 % --- Executes on selection change in popupmenu_desiredpvalCondition. 0392 function popupmenu_desiredpvalCondition_Callback(hObject, eventdata, handles) 0393 % hObject handle to popupmenu_desiredpvalCondition (see GCBO) 0394 % eventdata reserved - to be defined in a future version of MATLAB 0395 % handles structure with handles and user data (see GUIDATA) 0396 0397 % Hints: contents = cellstr(get(hObject,'String')) returns popupmenu_desiredpvalCondition contents as cell array 0398 % contents{get(hObject,'Value')} returns selected item from popupmenu_desiredpvalCondition 0399 0400 0401 % --- Executes during object creation, after setting all properties. 0402 function popupmenu_desiredpvalCondition_CreateFcn(hObject, eventdata, handles) 0403 % hObject handle to popupmenu_desiredpvalCondition (see GCBO) 0404 % eventdata reserved - to be defined in a future version of MATLAB 0405 % handles empty - handles not created until after all CreateFcns called 0406 0407 % Hint: popupmenu controls usually have a white background on Windows. 0408 % See ISPC and COMPUTER. 0409 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) 0410 set(hObject,'BackgroundColor','white'); 0411 end 0412 0413 0414 % --- Executes on selection change in popupmenu_tails. 0415 function popupmenu_tails_Callback(hObject, eventdata, handles) 0416 % hObject handle to popupmenu_tails (see GCBO) 0417 % eventdata reserved - to be defined in a future version of MATLAB 0418 % handles structure with handles and user data (see GUIDATA) 0419 0420 % Hints: contents = cellstr(get(hObject,'String')) returns popupmenu_tails contents as cell array 0421 % contents{get(hObject,'Value')} returns selected item from popupmenu_tails 0422 0423 0424 % --- Executes during object creation, after setting all properties. 0425 function popupmenu_tails_CreateFcn(hObject, eventdata, handles) 0426 % hObject handle to popupmenu_tails (see GCBO) 0427 % eventdata reserved - to be defined in a future version of MATLAB 0428 % handles empty - handles not created until after all CreateFcns called 0429 0430 % Hint: popupmenu controls usually have a white background on Windows. 0431 % See ISPC and COMPUTER. 0432 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) 0433 set(hObject,'BackgroundColor','white'); 0434 end 0435 0436 0437 % --- Executes on button press in pushbutton_create_ttest. 0438 function pushbutton_create_ttest_Callback(hObject, eventdata, handles) 0439 % hObject handle to pushbutton_create_ttest (see GCBO) 0440 % eventdata reserved - to be defined in a future version of MATLAB 0441 % handles structure with handles and user data (see GUIDATA) 0442 0443 type = getdfName(handles.popupmenu_type,'type'); 0444 0445 mainWindowHandle = sos_gui; 0446 mainWindowData = guidata(mainWindowHandle); 0447 0448 sosObjName = getdfName(mainWindowData.popupmenu_SOSSelector,'SOS'); 0449 0450 if isempty(sosObjName) == 0 0451 % we have a valid SOS object to add the test to 0452 % validate all of the parameters for the test 0453 create = validate_name(handles); 0454 name = get(handles.edit_name,'String'); 0455 0456 if create == true 0457 sample1 = getdfName(handles.popupmenu_sample1Selector,'sample 1'); 0458 0459 if isempty(sample1) == 0 0460 sample1Col = getdfName(handles.popupmenu_sample1ColSelector','sample 1 column'); 0461 0462 if isempty(sample1Col) == 0 0463 create = validate_targValue(handles); 0464 0465 if create == true 0466 targValue = get(handles.edit_targValue,'String'); 0467 0468 create = validate_desiredpval(handles); 0469 0470 if create == true 0471 0472 desiredpval = get(handles.edit_desiredpval,'String'); 0473 0474 desiredpvalCondition = getdfName(handles.popupmenu_desiredpvalCondition,... 0475 'desiredpvalCondition'); 0476 %all of the other options are in drop-down 0477 %menus and as such necessarily will pass. 0478 %run the command. 0479 0480 command = [sosObjName,'.addttest(',... 0481 '''name'',''',name,''',',... 0482 '''type'',''',type,''',',... 0483 '''sample1'',',sample1,',',... 0484 '''s1ColName'',''',sample1Col,''',',... 0485 '''targValue'',',targValue,',',... 0486 '''desiredpvalCondition'',''',desiredpvalCondition,''',',... 0487 '''desiredpval'',',desiredpval,');',... 0488 ]; 0489 0490 verbosePrint(['Executing command: ','''',command,''''],'createsinglesamplettest_Dialog_create'); 0491 evalin('base',command); 0492 close(handles.figure_createsinglesamplettest_Dialog); 0493 0494 end 0495 end 0496 0497 end 0498 end 0499 end 0500 0501 0502 end 0503 0504 0505 % --- Executes on selection change in popupmenu_type. 0506 function popupmenu_type_Callback(hObject, eventdata, handles) 0507 % hObject handle to popupmenu_type (see GCBO) 0508 % eventdata reserved - to be defined in a future version of MATLAB 0509 % handles structure with handles and user data (see GUIDATA) 0510 0511 % Hints: contents = cellstr(get(hObject,'String')) returns popupmenu_type contents as cell array 0512 % contents{get(hObject,'Value')} returns selected item from popupmenu_type 0513 0514 0515 % --- Executes during object creation, after setting all properties. 0516 function popupmenu_type_CreateFcn(hObject, eventdata, handles) 0517 % hObject handle to popupmenu_type (see GCBO) 0518 % eventdata reserved - to be defined in a future version of MATLAB 0519 % handles empty - handles not created until after all CreateFcns called 0520 0521 % Hint: popupmenu controls usually have a white background on Windows. 0522 % See ISPC and COMPUTER. 0523 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) 0524 set(hObject,'BackgroundColor','white'); 0525 end 0526 0527 0528 0529 function edit_targValue_Callback(hObject, eventdata, handles) 0530 % hObject handle to edit_targValue (see GCBO) 0531 % eventdata reserved - to be defined in a future version of MATLAB 0532 % handles structure with handles and user data (see GUIDATA) 0533 0534 % Hints: get(hObject,'String') returns contents of edit_targValue as text 0535 % str2double(get(hObject,'String')) returns contents of edit_targValue as a double 0536 validate_targValue(handles); 0537 0538 0539 function flag = validate_targValue(handles) 0540 str = get(handles.edit_targValue,'String'); 0541 0542 errmsg = 'target value must be a real number'; 0543 errtitle = 'Invalid targValue!'; 0544 0545 flag = validateRealNumber(str,errmsg,errtitle); 0546 0547 % --- Executes during object creation, after setting all properties. 0548 function edit_targValue_CreateFcn(hObject, eventdata, handles) 0549 % hObject handle to edit_targValue (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: edit 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