PageRenderTime 49ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 1ms

/ATF2/FlightSim/coreApps/SimSettings_dynamicErr.m

http://atf2flightsim.googlecode.com/
MATLAB | 788 lines | 286 code | 190 blank | 312 comment | 63 complexity | 63ee48aa7aa2a9a32a22eca85263cd1a MD5 | raw file
Possible License(s): BSD-2-Clause, LGPL-2.0, IPL-1.0, BSD-3-Clause
  1. function varargout = SimSettings_dynamicErr(varargin)
  2. % SIMSETTINGS_DYNAMICERR M-file for SimSettings_dynamicErr.fig
  3. % SIMSETTINGS_DYNAMICERR, by itself, creates a new SIMSETTINGS_DYNAMICERR or raises the existing
  4. % singleton*.
  5. %
  6. % H = SIMSETTINGS_DYNAMICERR returns the handle to a new SIMSETTINGS_DYNAMICERR or the handle to
  7. % the existing singleton*.
  8. %
  9. % SIMSETTINGS_DYNAMICERR('CALLBACK',hObject,eventData,handles,...) calls the local
  10. % function named CALLBACK in SIMSETTINGS_DYNAMICERR.M with the given input arguments.
  11. %
  12. % SIMSETTINGS_DYNAMICERR('Property','Value',...) creates a new SIMSETTINGS_DYNAMICERR or raises the
  13. % existing singleton*. Starting from the left, property value pairs are
  14. % applied to the GUI before SimSettings_dynamicErr_OpeningFcn gets called. An
  15. % unrecognized property name or invalid value makes property application
  16. % stop. All inputs are passed to SimSettings_dynamicErr_OpeningFcn via varargin.
  17. %
  18. % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
  19. % instance to run (singleton)".
  20. %
  21. % See also: GUIDE, GUIDATA, GUIHANDLES
  22. % Edit the above text to modify the response to help SimSettings_dynamicErr
  23. % Last Modified by GUIDE v2.5 08-Aug-2008 17:33:15
  24. % Begin initialization code - DO NOT EDIT
  25. gui_Singleton = 1;
  26. gui_State = struct('gui_Name', mfilename, ...
  27. 'gui_Singleton', gui_Singleton, ...
  28. 'gui_OpeningFcn', @SimSettings_dynamicErr_OpeningFcn, ...
  29. 'gui_OutputFcn', @SimSettings_dynamicErr_OutputFcn, ...
  30. 'gui_LayoutFcn', [] , ...
  31. 'gui_Callback', []);
  32. if nargin && ischar(varargin{1})
  33. gui_State.gui_Callback = str2func(varargin{1});
  34. end
  35. if nargout
  36. [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
  37. else
  38. gui_mainfcn(gui_State, varargin{:});
  39. end
  40. % End initialization code - DO NOT EDIT
  41. % --- Executes just before SimSettings_dynamicErr is made visible.
  42. function SimSettings_dynamicErr_OpeningFcn(hObject, eventdata, handles, varargin)
  43. % This function has no output args, see OutputFcn.
  44. % hObject handle to figure
  45. % eventdata reserved - to be defined in a future version of MATLAB
  46. % handles structure with handles and user data (see GUIDATA)
  47. % varargin command line arguments to SimSettings_dynamicErr (see
  48. % VARARGIN)
  49. global FL
  50. % Choose default command line output for SimSettings_dynamicErr
  51. handles.output = handles;
  52. % Update handles structure
  53. guidata(hObject, handles);
  54. % Temp align data structure
  55. udat=get(handles.figure1,'UserData');
  56. udat{1}=FL.SimModel.align;
  57. % Update error fields from Model structure
  58. % BPMs
  59. bpmStr={['Stripline = ' num2str(FL.SimModel.align.bpm_sres)];
  60. ['Cavity = ' num2str(FL.SimModel.align.bpm_cres)];
  61. ['IP = ' num2str(FL.SimModel.align.bpm_ipres)];
  62. ['Button = ' num2str(FL.SimModel.align.bpm_bres)]};
  63. set(handles.popupmenu2,'String',bpmStr);
  64. set(handles.popupmenu2,'Value',1);
  65. set(handles.edit1,'String',FL.SimModel.align.bpm_sres);
  66. set(handles.popupmenu2,'UserData',[FL.SimModel.align.bpm_sres FL.SimModel.align.bpm_cres FL.SimModel.align.bpm_ipres FL.SimModel.align.bpm_bres]);
  67. modelSET(handles,7,'dB_quad_dyn',1e5);
  68. modelSET(handles,8,'dB_sext_dyn',1e5);
  69. modelSET(handles,9,'dB_bend_dyn',1e5);
  70. modelSET(handles,10,'dB_cor_dyn',1e5);
  71. modelSET(handles,[3 20 21],'mover_step',1e6);
  72. modelSET(handles,4,'mover_accuracy_x',1e6);
  73. modelSET(handles,5,'mover_accuracy_y',1e6);
  74. modelSET(handles,6,'mover_accuracy_tilt',1e6);
  75. modelSET(handles,11,'incoming_x',1e6);
  76. modelSET(handles,12,'incoming_xp',1e6);
  77. modelSET(handles,13,'incoming_y',1e6);
  78. modelSET(handles,14,'incoming_yp',1e6);
  79. modelSET(handles,15,'incoming_e',1e4);
  80. gmModels=get(handles.popupmenu1,'String');
  81. if isfield(FL,'SimModel') && isfield(FL.SimModel,'align') && isfield(FL.SimModel.align,'gmModel')
  82. if any(ismember(gmModels,FL.SimModel.align.gmModel))
  83. set(handles.popupmenu1,'Value',find(ismember(gmModels,FL.SimModel.align.gmModel)));
  84. end % if find gmModel
  85. end % if FL.SimModel stuff
  86. modelSET(handles,16,'jitter_quad',1e9);
  87. modelSET(handles,17,'jitter_sext',1e9);
  88. modelSET(handles,18,'cor_psStep',1e6);
  89. modelSET(handles,19,'cor_dAmpl',1e5);
  90. udat{2}=figState(handles);
  91. set(handles.figure1,'UserData',udat);
  92. function modelSET(handles,field,str,conv)
  93. global FL
  94. if isfield(FL,'SimModel') && isfield(FL.SimModel,'align') && isfield(FL.SimModel.align,str)
  95. for ifield=1:length(field)
  96. set(handles.(['edit',num2str(field(ifield))]),'String',num2str(FL.SimModel.align.(str)(ifield)*conv));
  97. end % for ifield
  98. else
  99. errordlg(['Failed to get Model field: ',str],'SimSettings_dynamicErr error');
  100. end % if FL.SimModel.str
  101. % --- Outputs from this function are returned to the command line.
  102. function varargout = SimSettings_dynamicErr_OutputFcn(hObject, eventdata, handles)
  103. % varargout cell array for returning output args (see VARARGOUT);
  104. % hObject handle to figure
  105. % eventdata reserved - to be defined in a future version of MATLAB
  106. % handles structure with handles and user data (see GUIDATA)
  107. % Get default command line output from handles structure
  108. varargout{1} = handles.output;
  109. % --- Executes on button press in pushbutton1.
  110. function pushbutton1_Callback(hObject, eventdata, handles)
  111. % hObject handle to pushbutton1 (see GCBO)
  112. % eventdata reserved - to be defined in a future version of MATLAB
  113. % handles structure with handles and user data (see GUIDATA)
  114. udat=get(handles.figure1,'UserData');
  115. if ~isequal(figState(handles),udat{2})
  116. resp=questdlg('Settings have been changed but not saved','Settings Changed',...
  117. 'Quit anyway','Save before quiting','Cancel','Cancel');
  118. switch resp
  119. case 'Quit anyway'
  120. guiCloseFn('SimSettings_dynamicErr',handles);
  121. case 'Save before quiting'
  122. stat=saveErrData(handles);
  123. if stat{1}~=1
  124. errordlg(stat{2},'Static Error Save Error');
  125. else
  126. guiCloseFn('SimSettings_dynamicErr',handles);
  127. end % if err
  128. end % switch resp
  129. else
  130. guiCloseFn('SimSettings_dynamicErr',handles);
  131. end % if settings changed
  132. % --- Executes on button press in pushbutton2.
  133. function pushbutton2_Callback(hObject, eventdata, handles)
  134. % hObject handle to pushbutton2 (see GCBO)
  135. % eventdata reserved - to be defined in a future version of MATLAB
  136. % handles structure with handles and user data (see GUIDATA)
  137. stat=saveErrData(handles);
  138. if stat{1}~=1; errordlg(stat{2},'Static Error Save Error'); end;
  139. function stat=saveErrData(handles)
  140. global FL
  141. stat=modelGET(handles,7,'dB_quad_dyn',1e5); if stat{1}~=1; return; end;
  142. stat=modelGET(handles,8,'dB_sext_dyn',1e5); if stat{1}~=1; return; end;
  143. stat=modelGET(handles,9,'dB_bend_dyn',1e5); if stat{1}~=1; return; end;
  144. stat=modelGET(handles,10,'dB_cor_dyn',1e5); if stat{1}~=1; return; end;
  145. stat=modelGET(handles,[3 20 21],'mover_step',1e6); if stat{1}~=1; return; end;
  146. stat=modelGET(handles,4,'mover_accuracy_x',1e6); if stat{1}~=1; return; end;
  147. stat=modelGET(handles,5,'mover_accuracy_y',1e6); if stat{1}~=1; return; end;
  148. stat=modelGET(handles,6,'mover_accuracy_tilt',1e6); if stat{1}~=1; return; end;
  149. stat=modelGET(handles,11,'incoming_x',1e6); if stat{1}~=1; return; end;
  150. stat=modelGET(handles,12,'incoming_xp',1e6); if stat{1}~=1; return; end;
  151. stat=modelGET(handles,13,'incoming_y',1e6); if stat{1}~=1; return; end;
  152. stat=modelGET(handles,14,'incoming_yp',1e6); if stat{1}~=1; return; end;
  153. stat=modelGET(handles,15,'incoming_e',1e4); if stat{1}~=1; return; end;
  154. gmModels=get(handles.popupmenu1,'String');
  155. if isfield(FL,'SimModel') && isfield(FL.SimModel,'align') && isfield(FL.SimModel.align,'gmModel')
  156. if any(ismember(gmModels,FL.SimModel.align.gmModel))
  157. FL.SimModel.align.gmModel=gmModels{get(handles.popupmenu1,'Value')};
  158. end % if find gmModel
  159. end % if FL.SimModel stuff
  160. stat=modelGET(handles,16,'jitter_quad',1e9); if stat{1}~=1; return; end;
  161. stat=modelGET(handles,17,'jitter_sext',1e9); if stat{1}~=1; return; end;
  162. stat=modelGET(handles,18,'cor_psStep',1e6); if stat{1}~=1; return; end;
  163. stat=modelGET(handles,19,'cor_dAmpl',1e5); if stat{1}~=1; return; end;
  164. % BPM resolutions
  165. bpmres=get(handles.popupmenu2,'UserData');
  166. FL.SimModel.align.bpm_sres=bpmres(1);
  167. FL.SimModel.align.bpm_cres=bpmres(2);
  168. FL.SimModel.align.bpm_ipres=bpmres(3);
  169. FL.SimModel.align.bpm_bres=bpmres(4);
  170. stat = SimApplyErrors('dynamic');
  171. if stat{1}~=1; errordlg(stat{2},'Error saving model'); end;
  172. % Store save state
  173. udat=get(handles.figure1,'UserData');
  174. udat{2}=figState(handles);
  175. set(handles.figure1,'UserData',udat);
  176. function stat=modelGET(handles,field,str,conv)
  177. global FL
  178. if isfield(FL,'SimModel') && isfield(FL.SimModel,'align') && isfield(FL.SimModel.align,str)
  179. for ifield=1:length(field)
  180. FL.SimModel.align.(str)(ifield)=str2double(get(handles.(['edit',num2str(field(ifield))]),'String'))/conv;
  181. end % for ifield
  182. else
  183. stat{1}=-1; stat{2}=['Sim Model field not found: ',str];
  184. end % if FL.SimModel.str
  185. if any(isnan(FL.SimModel.align.(str))) || any(FL.SimModel.align.(str)<0)
  186. stat{1}=-1; stat{2}=[FL.SimModel.align.(field),' must be numeric and >0'];
  187. else
  188. stat{1}=1;
  189. end % check val
  190. function edit16_Callback(hObject, eventdata, handles)
  191. % hObject handle to edit16 (see GCBO)
  192. % eventdata reserved - to be defined in a future version of MATLAB
  193. % handles structure with handles and user data (see GUIDATA)
  194. % Hints: get(hObject,'String') returns contents of edit16 as text
  195. % str2double(get(hObject,'String')) returns contents of edit16 as a double
  196. % --- Executes during object creation, after setting all properties.
  197. function edit16_CreateFcn(hObject, eventdata, handles)
  198. % hObject handle to edit16 (see GCBO)
  199. % eventdata reserved - to be defined in a future version of MATLAB
  200. % handles empty - handles not created until after all CreateFcns called
  201. % Hint: edit controls usually have a white background on Windows.
  202. % See ISPC and COMPUTER.
  203. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  204. set(hObject,'BackgroundColor','white');
  205. end
  206. % --- Executes on selection change in popupmenu1.
  207. function popupmenu1_Callback(hObject, eventdata, handles)
  208. % hObject handle to popupmenu1 (see GCBO)
  209. % eventdata reserved - to be defined in a future version of MATLAB
  210. % handles structure with handles and user data (see GUIDATA)
  211. % Hints: contents = get(hObject,'String') returns popupmenu1 contents as cell array
  212. % contents{get(hObject,'Value')} returns selected item from popupmenu1
  213. % --- Executes during object creation, after setting all properties.
  214. function popupmenu1_CreateFcn(hObject, eventdata, handles)
  215. % hObject handle to popupmenu1 (see GCBO)
  216. % eventdata reserved - to be defined in a future version of MATLAB
  217. % handles empty - handles not created until after all CreateFcns called
  218. % Hint: popupmenu controls usually have a white background on Windows.
  219. % See ISPC and COMPUTER.
  220. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  221. set(hObject,'BackgroundColor','white');
  222. end
  223. function edit17_Callback(hObject, eventdata, handles)
  224. % hObject handle to edit17 (see GCBO)
  225. % eventdata reserved - to be defined in a future version of MATLAB
  226. % handles structure with handles and user data (see GUIDATA)
  227. % Hints: get(hObject,'String') returns contents of edit17 as text
  228. % str2double(get(hObject,'String')) returns contents of edit17 as a double
  229. % --- Executes during object creation, after setting all properties.
  230. function edit17_CreateFcn(hObject, eventdata, handles)
  231. % hObject handle to edit17 (see GCBO)
  232. % eventdata reserved - to be defined in a future version of MATLAB
  233. % handles empty - handles not created until after all CreateFcns called
  234. % Hint: edit controls usually have a white background on Windows.
  235. % See ISPC and COMPUTER.
  236. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  237. set(hObject,'BackgroundColor','white');
  238. end
  239. function edit11_Callback(hObject, eventdata, handles)
  240. % hObject handle to edit11 (see GCBO)
  241. % eventdata reserved - to be defined in a future version of MATLAB
  242. % handles structure with handles and user data (see GUIDATA)
  243. % Hints: get(hObject,'String') returns contents of edit11 as text
  244. % str2double(get(hObject,'String')) returns contents of edit11 as a double
  245. % --- Executes during object creation, after setting all properties.
  246. function edit11_CreateFcn(hObject, eventdata, handles)
  247. % hObject handle to edit11 (see GCBO)
  248. % eventdata reserved - to be defined in a future version of MATLAB
  249. % handles empty - handles not created until after all CreateFcns called
  250. % Hint: edit controls usually have a white background on Windows.
  251. % See ISPC and COMPUTER.
  252. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  253. set(hObject,'BackgroundColor','white');
  254. end
  255. function edit12_Callback(hObject, eventdata, handles)
  256. % hObject handle to edit12 (see GCBO)
  257. % eventdata reserved - to be defined in a future version of MATLAB
  258. % handles structure with handles and user data (see GUIDATA)
  259. % Hints: get(hObject,'String') returns contents of edit12 as text
  260. % str2double(get(hObject,'String')) returns contents of edit12 as a double
  261. % --- Executes during object creation, after setting all properties.
  262. function edit12_CreateFcn(hObject, eventdata, handles)
  263. % hObject handle to edit12 (see GCBO)
  264. % eventdata reserved - to be defined in a future version of MATLAB
  265. % handles empty - handles not created until after all CreateFcns called
  266. % Hint: edit controls usually have a white background on Windows.
  267. % See ISPC and COMPUTER.
  268. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  269. set(hObject,'BackgroundColor','white');
  270. end
  271. function edit13_Callback(hObject, eventdata, handles)
  272. % hObject handle to edit13 (see GCBO)
  273. % eventdata reserved - to be defined in a future version of MATLAB
  274. % handles structure with handles and user data (see GUIDATA)
  275. % Hints: get(hObject,'String') returns contents of edit13 as text
  276. % str2double(get(hObject,'String')) returns contents of edit13 as a double
  277. % --- Executes during object creation, after setting all properties.
  278. function edit13_CreateFcn(hObject, eventdata, handles)
  279. % hObject handle to edit13 (see GCBO)
  280. % eventdata reserved - to be defined in a future version of MATLAB
  281. % handles empty - handles not created until after all CreateFcns called
  282. % Hint: edit controls usually have a white background on Windows.
  283. % See ISPC and COMPUTER.
  284. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  285. set(hObject,'BackgroundColor','white');
  286. end
  287. function edit14_Callback(hObject, eventdata, handles)
  288. % hObject handle to edit14 (see GCBO)
  289. % eventdata reserved - to be defined in a future version of MATLAB
  290. % handles structure with handles and user data (see GUIDATA)
  291. % Hints: get(hObject,'String') returns contents of edit14 as text
  292. % str2double(get(hObject,'String')) returns contents of edit14 as a double
  293. % --- Executes during object creation, after setting all properties.
  294. function edit14_CreateFcn(hObject, eventdata, handles)
  295. % hObject handle to edit14 (see GCBO)
  296. % eventdata reserved - to be defined in a future version of MATLAB
  297. % handles empty - handles not created until after all CreateFcns called
  298. % Hint: edit controls usually have a white background on Windows.
  299. % See ISPC and COMPUTER.
  300. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  301. set(hObject,'BackgroundColor','white');
  302. end
  303. function edit15_Callback(hObject, eventdata, handles)
  304. % hObject handle to edit15 (see GCBO)
  305. % eventdata reserved - to be defined in a future version of MATLAB
  306. % handles structure with handles and user data (see GUIDATA)
  307. % Hints: get(hObject,'String') returns contents of edit15 as text
  308. % str2double(get(hObject,'String')) returns contents of edit15 as a double
  309. % --- Executes during object creation, after setting all properties.
  310. function edit15_CreateFcn(hObject, eventdata, handles)
  311. % hObject handle to edit15 (see GCBO)
  312. % eventdata reserved - to be defined in a future version of MATLAB
  313. % handles empty - handles not created until after all CreateFcns called
  314. % Hint: edit controls usually have a white background on Windows.
  315. % See ISPC and COMPUTER.
  316. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  317. set(hObject,'BackgroundColor','white');
  318. end
  319. function edit7_Callback(hObject, eventdata, handles)
  320. % hObject handle to edit7 (see GCBO)
  321. % eventdata reserved - to be defined in a future version of MATLAB
  322. % handles structure with handles and user data (see GUIDATA)
  323. % Hints: get(hObject,'String') returns contents of edit7 as text
  324. % str2double(get(hObject,'String')) returns contents of edit7 as a double
  325. % --- Executes during object creation, after setting all properties.
  326. function edit7_CreateFcn(hObject, eventdata, handles)
  327. % hObject handle to edit7 (see GCBO)
  328. % eventdata reserved - to be defined in a future version of MATLAB
  329. % handles empty - handles not created until after all CreateFcns called
  330. % Hint: edit controls usually have a white background on Windows.
  331. % See ISPC and COMPUTER.
  332. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  333. set(hObject,'BackgroundColor','white');
  334. end
  335. function edit8_Callback(hObject, eventdata, handles)
  336. % hObject handle to edit8 (see GCBO)
  337. % eventdata reserved - to be defined in a future version of MATLAB
  338. % handles structure with handles and user data (see GUIDATA)
  339. % Hints: get(hObject,'String') returns contents of edit8 as text
  340. % str2double(get(hObject,'String')) returns contents of edit8 as a double
  341. % --- Executes during object creation, after setting all properties.
  342. function edit8_CreateFcn(hObject, eventdata, handles)
  343. % hObject handle to edit8 (see GCBO)
  344. % eventdata reserved - to be defined in a future version of MATLAB
  345. % handles empty - handles not created until after all CreateFcns called
  346. % Hint: edit controls usually have a white background on Windows.
  347. % See ISPC and COMPUTER.
  348. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  349. set(hObject,'BackgroundColor','white');
  350. end
  351. function edit9_Callback(hObject, eventdata, handles)
  352. % hObject handle to edit9 (see GCBO)
  353. % eventdata reserved - to be defined in a future version of MATLAB
  354. % handles structure with handles and user data (see GUIDATA)
  355. % Hints: get(hObject,'String') returns contents of edit9 as text
  356. % str2double(get(hObject,'String')) returns contents of edit9 as a double
  357. % --- Executes during object creation, after setting all properties.
  358. function edit9_CreateFcn(hObject, eventdata, handles)
  359. % hObject handle to edit9 (see GCBO)
  360. % eventdata reserved - to be defined in a future version of MATLAB
  361. % handles empty - handles not created until after all CreateFcns called
  362. % Hint: edit controls usually have a white background on Windows.
  363. % See ISPC and COMPUTER.
  364. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  365. set(hObject,'BackgroundColor','white');
  366. end
  367. function edit10_Callback(hObject, eventdata, handles)
  368. % hObject handle to edit10 (see GCBO)
  369. % eventdata reserved - to be defined in a future version of MATLAB
  370. % handles structure with handles and user data (see GUIDATA)
  371. % Hints: get(hObject,'String') returns contents of edit10 as text
  372. % str2double(get(hObject,'String')) returns contents of edit10 as a double
  373. % --- Executes during object creation, after setting all properties.
  374. function edit10_CreateFcn(hObject, eventdata, handles)
  375. % hObject handle to edit10 (see GCBO)
  376. % eventdata reserved - to be defined in a future version of MATLAB
  377. % handles empty - handles not created until after all CreateFcns called
  378. % Hint: edit controls usually have a white background on Windows.
  379. % See ISPC and COMPUTER.
  380. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  381. set(hObject,'BackgroundColor','white');
  382. end
  383. function edit3_Callback(hObject, eventdata, handles)
  384. % hObject handle to edit3 (see GCBO)
  385. % eventdata reserved - to be defined in a future version of MATLAB
  386. % handles structure with handles and user data (see GUIDATA)
  387. % Hints: get(hObject,'String') returns contents of edit3 as text
  388. % str2double(get(hObject,'String')) returns contents of edit3 as a double
  389. % --- Executes during object creation, after setting all properties.
  390. function edit3_CreateFcn(hObject, eventdata, handles)
  391. % hObject handle to edit3 (see GCBO)
  392. % eventdata reserved - to be defined in a future version of MATLAB
  393. % handles empty - handles not created until after all CreateFcns called
  394. % Hint: edit controls usually have a white background on Windows.
  395. % See ISPC and COMPUTER.
  396. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  397. set(hObject,'BackgroundColor','white');
  398. end
  399. function edit4_Callback(hObject, eventdata, handles)
  400. % hObject handle to edit4 (see GCBO)
  401. % eventdata reserved - to be defined in a future version of MATLAB
  402. % handles structure with handles and user data (see GUIDATA)
  403. % Hints: get(hObject,'String') returns contents of edit4 as text
  404. % str2double(get(hObject,'String')) returns contents of edit4 as a double
  405. % --- Executes during object creation, after setting all properties.
  406. function edit4_CreateFcn(hObject, eventdata, handles)
  407. % hObject handle to edit4 (see GCBO)
  408. % eventdata reserved - to be defined in a future version of MATLAB
  409. % handles empty - handles not created until after all CreateFcns called
  410. % Hint: edit controls usually have a white background on Windows.
  411. % See ISPC and COMPUTER.
  412. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  413. set(hObject,'BackgroundColor','white');
  414. end
  415. function edit5_Callback(hObject, eventdata, handles)
  416. % hObject handle to edit5 (see GCBO)
  417. % eventdata reserved - to be defined in a future version of MATLAB
  418. % handles structure with handles and user data (see GUIDATA)
  419. % Hints: get(hObject,'String') returns contents of edit5 as text
  420. % str2double(get(hObject,'String')) returns contents of edit5 as a double
  421. % --- Executes during object creation, after setting all properties.
  422. function edit5_CreateFcn(hObject, eventdata, handles)
  423. % hObject handle to edit5 (see GCBO)
  424. % eventdata reserved - to be defined in a future version of MATLAB
  425. % handles empty - handles not created until after all CreateFcns called
  426. % Hint: edit controls usually have a white background on Windows.
  427. % See ISPC and COMPUTER.
  428. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  429. set(hObject,'BackgroundColor','white');
  430. end
  431. function edit6_Callback(hObject, eventdata, handles)
  432. % hObject handle to edit6 (see GCBO)
  433. % eventdata reserved - to be defined in a future version of MATLAB
  434. % handles structure with handles and user data (see GUIDATA)
  435. % Hints: get(hObject,'String') returns contents of edit6 as text
  436. % str2double(get(hObject,'String')) returns contents of edit6 as a double
  437. % --- Executes during object creation, after setting all properties.
  438. function edit6_CreateFcn(hObject, eventdata, handles)
  439. % hObject handle to edit6 (see GCBO)
  440. % eventdata reserved - to be defined in a future version of MATLAB
  441. % handles empty - handles not created until after all CreateFcns called
  442. % Hint: edit controls usually have a white background on Windows.
  443. % See ISPC and COMPUTER.
  444. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  445. set(hObject,'BackgroundColor','white');
  446. end
  447. function edit1_Callback(hObject, eventdata, handles)
  448. % hObject handle to edit1 (see GCBO)
  449. % eventdata reserved - to be defined in a future version of MATLAB
  450. % handles structure with handles and user data (see GUIDATA)
  451. % Hints: get(hObject,'String') returns contents of edit1 as text
  452. % str2double(get(hObject,'String')) returns contents of edit1 as a double
  453. if isnan(str2double(get(hObject,'String')))
  454. errordlg('Not a number!','BPM resolution setting error');
  455. return
  456. end % if isnan edit
  457. bpmVal=get(handles.popupmenu2,'Value');
  458. data=get(handles.popupmenu2,'UserData');
  459. data(bpmVal)=str2double(get(hObject,'String'));
  460. names={'Stripline = ','Cavity = ','IP = ','Button = '};
  461. bpmstr=get(handles.popupmenu2,'String');
  462. bpmstr{bpmVal}=[names{bpmVal} num2str(data(bpmVal))];
  463. set(handles.popupmenu2,'String',bpmstr);
  464. % --- Executes during object creation, after setting all properties.
  465. function edit1_CreateFcn(hObject, eventdata, handles)
  466. % hObject handle to edit1 (see GCBO)
  467. % eventdata reserved - to be defined in a future version of MATLAB
  468. % handles empty - handles not created until after all CreateFcns called
  469. % Hint: edit controls usually have a white background on Windows.
  470. % See ISPC and COMPUTER.
  471. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  472. set(hObject,'BackgroundColor','white');
  473. end
  474. function edit2_Callback(hObject, eventdata, handles)
  475. % hObject handle to edit2 (see GCBO)
  476. % eventdata reserved - to be defined in a future version of MATLAB
  477. % handles structure with handles and user data (see GUIDATA)
  478. % Hints: get(hObject,'String') returns contents of edit2 as text
  479. % str2double(get(hObject,'String')) returns contents of edit2 as a double
  480. % --- Executes during object creation, after setting all properties.
  481. function edit2_CreateFcn(hObject, eventdata, handles)
  482. % hObject handle to edit2 (see GCBO)
  483. % eventdata reserved - to be defined in a future version of MATLAB
  484. % handles empty - handles not created until after all CreateFcns called
  485. % Hint: edit controls usually have a white background on Windows.
  486. % See ISPC and COMPUTER.
  487. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  488. set(hObject,'BackgroundColor','white');
  489. end
  490. function edit18_Callback(hObject, eventdata, handles)
  491. % hObject handle to edit18 (see GCBO)
  492. % eventdata reserved - to be defined in a future version of MATLAB
  493. % handles structure with handles and user data (see GUIDATA)
  494. % Hints: get(hObject,'String') returns contents of edit18 as text
  495. % str2double(get(hObject,'String')) returns contents of edit18 as a double
  496. % --- Executes during object creation, after setting all properties.
  497. function edit18_CreateFcn(hObject, eventdata, handles)
  498. % hObject handle to edit18 (see GCBO)
  499. % eventdata reserved - to be defined in a future version of MATLAB
  500. % handles empty - handles not created until after all CreateFcns called
  501. % Hint: edit controls usually have a white background on Windows.
  502. % See ISPC and COMPUTER.
  503. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  504. set(hObject,'BackgroundColor','white');
  505. end
  506. function edit19_Callback(hObject, eventdata, handles)
  507. % hObject handle to edit19 (see GCBO)
  508. % eventdata reserved - to be defined in a future version of MATLAB
  509. % handles structure with handles and user data (see GUIDATA)
  510. % Hints: get(hObject,'String') returns contents of edit19 as text
  511. % str2double(get(hObject,'String')) returns contents of edit19 as a double
  512. % --- Executes during object creation, after setting all properties.
  513. function edit19_CreateFcn(hObject, eventdata, handles)
  514. % hObject handle to edit19 (see GCBO)
  515. % eventdata reserved - to be defined in a future version of MATLAB
  516. % handles empty - handles not created until after all CreateFcns called
  517. % Hint: edit controls usually have a white background on Windows.
  518. % See ISPC and COMPUTER.
  519. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  520. set(hObject,'BackgroundColor','white');
  521. end
  522. % --- Executes when user attempts to close figure1.
  523. function figure1_CloseRequestFcn(hObject, eventdata, handles)
  524. % hObject handle to figure1 (see GCBO)
  525. % eventdata reserved - to be defined in a future version of MATLAB
  526. % handles structure with handles and user data (see GUIDATA)
  527. guiCloseFn('SimSettings_dynamicErr',handles);
  528. % --- Executes on selection change in popupmenu2.
  529. function popupmenu2_Callback(hObject, eventdata, handles)
  530. % hObject handle to popupmenu2 (see GCBO)
  531. % eventdata reserved - to be defined in a future version of MATLAB
  532. % handles structure with handles and user data (see GUIDATA)
  533. % Hints: contents = get(hObject,'String') returns popupmenu2 contents as cell array
  534. % contents{get(hObject,'Value')} returns selected item from popupmenu2
  535. data=get(hObject,'UserData');
  536. if isnan(str2double(get(handles.edit1,'String')))
  537. errordlg('Invalid resolution entry','Dynamic error setting error');
  538. return
  539. end % if isnan
  540. set(handles.edit1,'String',num2str(data(get(hObject,'Value'))));
  541. % --- Executes during object creation, after setting all properties.
  542. function popupmenu2_CreateFcn(hObject, eventdata, handles)
  543. % hObject handle to popupmenu2 (see GCBO)
  544. % eventdata reserved - to be defined in a future version of MATLAB
  545. % handles empty - handles not created until after all CreateFcns called
  546. % Hint: popupmenu controls usually have a white background on Windows.
  547. % See ISPC and COMPUTER.
  548. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  549. set(hObject,'BackgroundColor','white');
  550. end
  551. % Get array of Value and String properties for this figure
  552. function array = figState(handles)
  553. hans=fieldnames(handles);
  554. array=[];
  555. for ihan=1:length(hans)
  556. if ~isequal(hans{ihan},'pushbutton1') && ~isequal(hans{ihan},'pushbutton2')
  557. try
  558. array=[array double(get(handles.(hans{ihan}),'String'))];
  559. catch
  560. end % try/catch
  561. try
  562. array=[array get(handles.(hans{ihan}),'Value')];
  563. catch
  564. end % try/catch
  565. end % if not pushbutton1 or 2 (exit or save button)
  566. end % for ihan
  567. function edit20_Callback(hObject, eventdata, handles)
  568. % hObject handle to edit20 (see GCBO)
  569. % eventdata reserved - to be defined in a future version of MATLAB
  570. % handles structure with handles and user data (see GUIDATA)
  571. % Hints: get(hObject,'String') returns contents of edit20 as text
  572. % str2double(get(hObject,'String')) returns contents of edit20 as a double
  573. % --- Executes during object creation, after setting all properties.
  574. function edit20_CreateFcn(hObject, eventdata, handles)
  575. % hObject handle to edit20 (see GCBO)
  576. % eventdata reserved - to be defined in a future version of MATLAB
  577. % handles empty - handles not created until after all CreateFcns called
  578. % Hint: edit controls usually have a white background on Windows.
  579. % See ISPC and COMPUTER.
  580. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  581. set(hObject,'BackgroundColor','white');
  582. end
  583. function edit21_Callback(hObject, eventdata, handles)
  584. % hObject handle to edit21 (see GCBO)
  585. % eventdata reserved - to be defined in a future version of MATLAB
  586. % handles structure with handles and user data (see GUIDATA)
  587. % Hints: get(hObject,'String') returns contents of edit21 as text
  588. % str2double(get(hObject,'String')) returns contents of edit21 as a double
  589. % --- Executes during object creation, after setting all properties.
  590. function edit21_CreateFcn(hObject, eventdata, handles)
  591. % hObject handle to edit21 (see GCBO)
  592. % eventdata reserved - to be defined in a future version of MATLAB
  593. % handles empty - handles not created until after all CreateFcns called
  594. % Hint: edit controls usually have a white background on Windows.
  595. % See ISPC and COMPUTER.
  596. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  597. set(hObject,'BackgroundColor','white');
  598. end