PageRenderTime 31ms CodeModel.GetById 0ms RepoModel.GetById 1ms app.codeStats 0ms

/ATF2/FlightSim/coreApps/FlFB_settingsGUI.m

http://atf2flightsim.googlecode.com/
MATLAB | 448 lines | 189 code | 97 blank | 162 comment | 23 complexity | 61b571dace7d09a4d8dcf2c6990157bd MD5 | raw file
Possible License(s): BSD-2-Clause, LGPL-2.0, IPL-1.0, BSD-3-Clause
  1. function varargout = FlFB_settingsGUI(varargin)
  2. % FLFB_SETTINGSGUI M-file for FlFB_settingsGUI.fig
  3. % FLFB_SETTINGSGUI, by itself, creates a new FLFB_SETTINGSGUI or raises the existing
  4. % singleton*.
  5. %
  6. % H = FLFB_SETTINGSGUI returns the handle to a new FLFB_SETTINGSGUI or the handle to
  7. % the existing singleton*.
  8. %
  9. % FLFB_SETTINGSGUI('CALLBACK',hObject,eventData,handles,...) calls the local
  10. % function named CALLBACK in FLFB_SETTINGSGUI.M with the given input arguments.
  11. %
  12. % FLFB_SETTINGSGUI('Property','Value',...) creates a new FLFB_SETTINGSGUI or raises the
  13. % existing singleton*. Starting from the left, property value pairs are
  14. % applied to the GUI before FlFB_settingsGUI_OpeningFcn gets called. An
  15. % unrecognized property name or invalid value makes property application
  16. % stop. All inputs are passed to FlFB_settingsGUI_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 FlFB_settingsGUI
  23. % Last Modified by GUIDE v2.5 08-Nov-2010 16:55:33
  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', @FlFB_settingsGUI_OpeningFcn, ...
  29. 'gui_OutputFcn', @FlFB_settingsGUI_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 FlFB_settingsGUI is made visible.
  42. function FlFB_settingsGUI_OpeningFcn(hObject, eventdata, handles, varargin) %#ok<*INUSL>
  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 FlFB_settingsGUI (see VARARGIN)
  48. % Choose default command line output for FlFB_settingsGUI
  49. handles.output = handles;
  50. % Update handles structure
  51. guidata(hObject, handles);
  52. [~, pars]=FlFB('GetPars');
  53. set(handles.edit1,'String',num2str(pars.PI(1)))
  54. set(handles.edit2,'String',num2str(pars.PI(2)))
  55. set(handles.edit5,'String',num2str(pars.PI_sext(1)))
  56. set(handles.edit6,'String',num2str(pars.PI_sext(2)))
  57. set(handles.radiobutton1,'Value',pars.applyFB(1))
  58. set(handles.radiobutton2,'Value',pars.applyFB(2))
  59. set(handles.radiobutton3,'Value',pars.applyFB(3))
  60. for iname=1:length(pars.bpmname)
  61. wstr{iname}=sprintf('%s : %.2f (x) %.2f (y)',pars.bpmname{iname},pars.weights(iname),pars.weights(length(pars.bpmname)+iname));
  62. end
  63. set(handles.popupmenu1,'String',wstr)
  64. set(handles.popupmenu1,'Value',1)
  65. popupmenu1_Callback(handles.popupmenu1,[],handles);
  66. % UIWAIT makes FlFB_settingsGUI wait for user response (see UIRESUME)
  67. % uiwait(handles.figure1);
  68. % --- Outputs from this function are returned to the command line.
  69. function varargout = FlFB_settingsGUI_OutputFcn(hObject, eventdata, handles)
  70. % varargout cell array for returning output args (see VARARGOUT);
  71. % hObject handle to figure
  72. % eventdata reserved - to be defined in a future version of MATLAB
  73. % handles structure with handles and user data (see GUIDATA)
  74. % Get default command line output from handles structure
  75. varargout{1} = handles.output;
  76. % --- Executes on button press in pushbutton1.
  77. function pushbutton1_Callback(hObject, eventdata, handles) %#ok<*INUSD,*DEFNU>
  78. % hObject handle to pushbutton1 (see GCBO)
  79. % eventdata reserved - to be defined in a future version of MATLAB
  80. % handles structure with handles and user data (see GUIDATA)
  81. guiCloseFn('FlFB_settingsGUI',handles);
  82. % --- Executes on button press in togglebutton1.
  83. function togglebutton1_Callback(hObject, eventdata, handles)
  84. % hObject handle to togglebutton1 (see GCBO)
  85. % eventdata reserved - to be defined in a future version of MATLAB
  86. % handles structure with handles and user data (see GUIDATA)
  87. if get(hObject,'Value')
  88. newpars.diagnostics=true;
  89. else
  90. newpars.diagnostics=false;
  91. end
  92. FlFB('SetPars',newpars);
  93. function edit1_Callback(hObject, eventdata, handles)
  94. % hObject handle to edit1 (see GCBO)
  95. % eventdata reserved - to be defined in a future version of MATLAB
  96. % handles structure with handles and user data (see GUIDATA)
  97. val=str2double(get(hObject,'String'));
  98. if isnan(val) || val<0 || val>2
  99. set(hObject,'String','---');
  100. else
  101. [stat pars]=FlFB('GetPars');
  102. newpars.PI=pars.PI;
  103. newpars.PI(1)=val;
  104. FlFB('SetPars',newpars);
  105. end
  106. % --- Executes during object creation, after setting all properties.
  107. function edit1_CreateFcn(hObject, eventdata, handles)
  108. % hObject handle to edit1 (see GCBO)
  109. % eventdata reserved - to be defined in a future version of MATLAB
  110. % handles empty - handles not created until after all CreateFcns called
  111. % Hint: edit controls usually have a white background on Windows.
  112. % See ISPC and COMPUTER.
  113. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  114. set(hObject,'BackgroundColor','white');
  115. end
  116. function edit2_Callback(hObject, eventdata, handles)
  117. % hObject handle to edit2 (see GCBO)
  118. % eventdata reserved - to be defined in a future version of MATLAB
  119. % handles structure with handles and user data (see GUIDATA)
  120. val=str2double(get(hObject,'String'));
  121. if isnan(val) || val<0 || val>2
  122. set(hObject,'String','---');
  123. else
  124. [stat pars]=FlFB('GetPars');
  125. newpars.PI=pars.PI;
  126. newpars.PI(2)=val;
  127. FlFB('SetPars',newpars);
  128. end
  129. % --- Executes during object creation, after setting all properties.
  130. function edit2_CreateFcn(hObject, eventdata, handles)
  131. % hObject handle to edit2 (see GCBO)
  132. % eventdata reserved - to be defined in a future version of MATLAB
  133. % handles empty - handles not created until after all CreateFcns called
  134. % Hint: edit controls usually have a white background on Windows.
  135. % See ISPC and COMPUTER.
  136. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  137. set(hObject,'BackgroundColor','white');
  138. end
  139. % --- Executes when user attempts to close figure1.
  140. function figure1_CloseRequestFcn(hObject, eventdata, handles)
  141. % hObject handle to figure1 (see GCBO)
  142. % eventdata reserved - to be defined in a future version of MATLAB
  143. % handles structure with handles and user data (see GUIDATA)
  144. guiCloseFn('FlFB_settingsGUI',handles);
  145. % --- Executes on button press in togglebutton2.
  146. function togglebutton2_Callback(hObject, eventdata, handles)
  147. % hObject handle to togglebutton2 (see GCBO)
  148. % eventdata reserved - to be defined in a future version of MATLAB
  149. % handles structure with handles and user data (see GUIDATA)
  150. if get(hObject,'Value')
  151. newpars.diagnostics_ipfit=true;
  152. else
  153. newpars.diagnostics_ipfit=false;
  154. end
  155. FlFB('SetPars',newpars);
  156. % --- Use orbit FB
  157. function radiobutton1_Callback(hObject, eventdata, handles)
  158. % hObject handle to radiobutton1 (see GCBO)
  159. % eventdata reserved - to be defined in a future version of MATLAB
  160. % handles structure with handles and user data (see GUIDATA)
  161. [~, pars]=FlFB('GetPars');
  162. newpars.applyFB=pars.applyFB;
  163. if get(hObject,'Value')
  164. newpars.applyFB(1)=true;
  165. else
  166. newpars.applyFB(1)=false;
  167. end
  168. FlFB('SetPars',newpars);
  169. % --- Use FFS Sext FB
  170. function radiobutton2_Callback(hObject, eventdata, handles)
  171. % hObject handle to radiobutton2 (see GCBO)
  172. % eventdata reserved - to be defined in a future version of MATLAB
  173. % handles structure with handles and user data (see GUIDATA)
  174. [~, pars]=FlFB('GetPars');
  175. newpars.applyFB=pars.applyFB;
  176. if get(hObject,'Value')
  177. newpars.applyFB(2)=true;
  178. else
  179. newpars.applyFB(2)=false;
  180. end
  181. FlFB('SetPars',newpars);
  182. % --- Use IP FB
  183. function radiobutton3_Callback(hObject, eventdata, handles)
  184. % hObject handle to radiobutton3 (see GCBO)
  185. % eventdata reserved - to be defined in a future version of MATLAB
  186. % handles structure with handles and user data (see GUIDATA)
  187. [~, pars]=FlFB('GetPars');
  188. newpars.applyFB=pars.applyFB;
  189. if get(hObject,'Value')
  190. newpars.applyFB(3)=true;
  191. else
  192. newpars.applyFB(3)=false;
  193. end
  194. FlFB('SetPars',newpars);
  195. % --- Executes on button press in pushbutton2.
  196. function pushbutton2_Callback(hObject, eventdata, handles)
  197. % hObject handle to pushbutton2 (see GCBO)
  198. % eventdata reserved - to be defined in a future version of MATLAB
  199. % handles structure with handles and user data (see GUIDATA)
  200. % --- BPM weights list
  201. function popupmenu1_Callback(hObject, eventdata, handles)
  202. % hObject handle to popupmenu1 (see GCBO)
  203. % eventdata reserved - to be defined in a future version of MATLAB
  204. % handles structure with handles and user data (see GUIDATA)
  205. [stat pars]=FlFB('GetPars');
  206. ibpm=get(hObject,'Value');
  207. set(handles.edit3,'String',num2str(pars.weights(ibpm)))
  208. set(handles.edit4,'String',num2str(pars.weights(length(pars.bpminstr)+ibpm)))
  209. % --- Executes during object creation, after setting all properties.
  210. function popupmenu1_CreateFcn(hObject, eventdata, handles)
  211. % hObject handle to popupmenu1 (see GCBO)
  212. % eventdata reserved - to be defined in a future version of MATLAB
  213. % handles empty - handles not created until after all CreateFcns called
  214. % Hint: popupmenu controls usually have a white background on Windows.
  215. % See ISPC and COMPUTER.
  216. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  217. set(hObject,'BackgroundColor','white');
  218. end
  219. function edit3_Callback(hObject, eventdata, handles)
  220. % hObject handle to edit3 (see GCBO)
  221. % eventdata reserved - to be defined in a future version of MATLAB
  222. % handles structure with handles and user data (see GUIDATA)
  223. weight=str2double(get(hObject,'String'));
  224. if isnan(weight) || weight<0
  225. errordlg('Weight must be real number > 0');
  226. set(hObject,'String','1')
  227. else
  228. [stat pars]=FlFB('GetPars'); newpars.weights=pars.weights;
  229. ibpm=get(handles.popupmenu1,'Value');
  230. newpars.weights(ibpm)=weight;
  231. FlFB('SetPars',newpars);
  232. end
  233. % --- Executes during object creation, after setting all properties.
  234. function edit3_CreateFcn(hObject, eventdata, handles)
  235. % hObject handle to edit3 (see GCBO)
  236. % eventdata reserved - to be defined in a future version of MATLAB
  237. % handles empty - handles not created until after all CreateFcns called
  238. % Hint: edit controls usually have a white background on Windows.
  239. % See ISPC and COMPUTER.
  240. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  241. set(hObject,'BackgroundColor','white');
  242. end
  243. function edit4_Callback(hObject, eventdata, handles)
  244. % hObject handle to edit4 (see GCBO)
  245. % eventdata reserved - to be defined in a future version of MATLAB
  246. % handles structure with handles and user data (see GUIDATA)
  247. weight=str2double(get(hObject,'String'));
  248. if isnan(weight) || weight<0
  249. errordlg('Weight must be real number > 0');
  250. set(hObject,'String','1')
  251. else
  252. [stat pars]=FlFB('GetPars'); newpars.weights=pars.weights;
  253. ibpm=get(handles.popupmenu1,'Value');
  254. newpars.weights(length(pars.bpminstr)+ibpm)=weight;
  255. FlFB('SetPars',newpars);
  256. end
  257. % --- Executes during object creation, after setting all properties.
  258. function edit4_CreateFcn(hObject, eventdata, handles)
  259. % hObject handle to edit4 (see GCBO)
  260. % eventdata reserved - to be defined in a future version of MATLAB
  261. % handles empty - handles not created until after all CreateFcns called
  262. % Hint: edit controls usually have a white background on Windows.
  263. % See ISPC and COMPUTER.
  264. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  265. set(hObject,'BackgroundColor','white');
  266. end
  267. function edit6_Callback(hObject, eventdata, handles)
  268. % hObject handle to edit6 (see GCBO)
  269. % eventdata reserved - to be defined in a future version of MATLAB
  270. % handles structure with handles and user data (see GUIDATA)
  271. I=str2double(get(hObject,'String'));
  272. if isnan(I)
  273. errordlg('I Coefficient must be a real number!')
  274. set(hObject,'String','0.1')
  275. else
  276. [stat pars]=FlFB('GetPars'); newpars.PI_sext=pars.PI_sext;
  277. newpars.PI_sext(2)=I;
  278. FlFB('SetPars',newpars);
  279. end
  280. % --- Executes during object creation, after setting all properties.
  281. function edit6_CreateFcn(hObject, eventdata, handles)
  282. % hObject handle to edit6 (see GCBO)
  283. % eventdata reserved - to be defined in a future version of MATLAB
  284. % handles empty - handles not created until after all CreateFcns called
  285. % Hint: edit controls usually have a white background on Windows.
  286. % See ISPC and COMPUTER.
  287. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  288. set(hObject,'BackgroundColor','white');
  289. end
  290. function edit5_Callback(hObject, eventdata, handles)
  291. % hObject handle to edit5 (see GCBO)
  292. % eventdata reserved - to be defined in a future version of MATLAB
  293. % handles structure with handles and user data (see GUIDATA)
  294. P=str2double(get(hObject,'String'));
  295. if isnan(P)
  296. errordlg('P Coefficient must be a real number!')
  297. set(hObject,'String','0.3')
  298. else
  299. [stat pars]=FlFB('GetPars'); newpars.PI_sext=pars.PI_sext;
  300. newpars.PI_sext(1)=P;
  301. FlFB('SetPars',newpars);
  302. end
  303. % --- Executes during object creation, after setting all properties.
  304. function edit5_CreateFcn(hObject, eventdata, handles)
  305. % hObject handle to edit5 (see GCBO)
  306. % eventdata reserved - to be defined in a future version of MATLAB
  307. % handles empty - handles not created until after all CreateFcns called
  308. % Hint: edit controls usually have a white background on Windows.
  309. % See ISPC and COMPUTER.
  310. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  311. set(hObject,'BackgroundColor','white');
  312. end
  313. % --- lauch Spectral Analysis GUI
  314. function pushbutton3_Callback(hObject, eventdata, handles)
  315. % hObject handle to pushbutton3 (see GCBO)
  316. % eventdata reserved - to be defined in a future version of MATLAB
  317. % handles structure with handles and user data (see GUIDATA)
  318. global FL
  319. FL.Gui.FlFB_spectralAnalGUI=FlFB_spectralAnalGUI;
  320. % --- Executes on slider movement.
  321. function slider2_Callback(hObject, eventdata, handles)
  322. % hObject handle to slider2 (see GCBO)
  323. % eventdata reserved - to be defined in a future version of MATLAB
  324. % handles structure with handles and user data (see GUIDATA)
  325. % Hints: get(hObject,'Value') returns position of slider
  326. % get(hObject,'Min') and get(hObject,'Max') to determine range of slider
  327. % --- Executes during object creation, after setting all properties.
  328. function slider2_CreateFcn(hObject, eventdata, handles)
  329. % hObject handle to slider2 (see GCBO)
  330. % eventdata reserved - to be defined in a future version of MATLAB
  331. % handles empty - handles not created until after all CreateFcns called
  332. % Hint: slider controls usually have a light gray background.
  333. if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  334. set(hObject,'BackgroundColor',[.9 .9 .9]);
  335. end
  336. function edit8_Callback(hObject, eventdata, handles)
  337. % hObject handle to edit8 (see GCBO)
  338. % eventdata reserved - to be defined in a future version of MATLAB
  339. % handles structure with handles and user data (see GUIDATA)
  340. % Hints: get(hObject,'String') returns contents of edit8 as text
  341. % str2double(get(hObject,'String')) returns contents of edit8 as a double
  342. % --- Executes during object creation, after setting all properties.
  343. function edit8_CreateFcn(hObject, eventdata, handles)
  344. % hObject handle to edit8 (see GCBO)
  345. % eventdata reserved - to be defined in a future version of MATLAB
  346. % handles empty - handles not created until after all CreateFcns called
  347. % Hint: edit controls usually have a white background on Windows.
  348. % See ISPC and COMPUTER.
  349. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  350. set(hObject,'BackgroundColor','white');
  351. end