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

/ATF2/FlightSim/coreApps/FlFB_spectralAnalGUI.m

http://atf2flightsim.googlecode.com/
MATLAB | 879 lines | 445 code | 165 blank | 269 comment | 63 complexity | a8b01692879967bcefbbea41825220da MD5 | raw file
Possible License(s): BSD-2-Clause, LGPL-2.0, IPL-1.0, BSD-3-Clause
  1. function varargout = FlFB_spectralAnalGUI(varargin)
  2. % FLFB_SPECTRALANALGUI MATLAB code for FlFB_spectralAnalGUI.fig
  3. % FLFB_SPECTRALANALGUI, by itself, creates a new FLFB_SPECTRALANALGUI or raises the existing
  4. % singleton*.
  5. %
  6. % H = FLFB_SPECTRALANALGUI returns the handle to a new FLFB_SPECTRALANALGUI or the handle to
  7. % the existing singleton*.
  8. %
  9. % FLFB_SPECTRALANALGUI('CALLBACK',hObject,eventData,handles,...) calls the local
  10. % function named CALLBACK in FLFB_SPECTRALANALGUI.M with the given input arguments.
  11. %
  12. % FLFB_SPECTRALANALGUI('Property','Value',...) creates a new FLFB_SPECTRALANALGUI or raises the
  13. % existing singleton*. Starting from the left, property value pairs are
  14. % applied to the GUI before FlFB_spectralAnalGUI_OpeningFcn gets called. An
  15. % unrecognized property name or invalid value makes property application
  16. % stop. All inputs are passed to FlFB_spectralAnalGUI_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_spectralAnalGUI
  23. % Last Modified by GUIDE v2.5 02-Nov-2010 15:06:26
  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_spectralAnalGUI_OpeningFcn, ...
  29. 'gui_OutputFcn', @FlFB_spectralAnalGUI_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_spectralAnalGUI is made visible.
  42. function FlFB_spectralAnalGUI_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_spectralAnalGUI (see VARARGIN)
  48. % Choose default command line output for FlFB_spectralAnalGUI
  49. handles.output = handles;
  50. % Restore setting from previous GUI session
  51. restoreList={'checkbox1','Value',0;'checkbox2','Value',0;'checkbox3','Value',0;
  52. 'checkbox4','Value',0;'radiobutton8','Value',0;
  53. 'radiobutton9','Value',0;'radiobutton1','Value',0;'radiobutton2','Value',0;
  54. 'radiobutton3','Value',0;'radiobutton4','Value',0;'radiobutton5','Value',0;
  55. 'uipanel10','Title',0;'text6','String',0;'edit4','String',0;
  56. 'checkbox14','Value',0};
  57. guiRestoreFn('FlFB_spectralAnalGUI',handles,restoreList);
  58. % Set options from FlFB function pars
  59. [stat pars]=FlFB('GetPars');
  60. if ~pars.specAnal_npulse
  61. set(handles.checkbox14,'Value',1)
  62. else
  63. set(handles.edit4,'String',num2str(pars.specAnal_npulse))
  64. end
  65. set(handles.edit5,'String',num2str(pars.specAnal_nsimTrack))
  66. set(handles.checkbox8,'Value',pars.specAnal_drivex)
  67. set(handles.checkbox9,'Value',pars.specAnal_drivey)
  68. set(handles.checkbox7,'Value',pars.specAnal_drivee)
  69. set(handles.checkbox5,'Value',pars.specAnal_drivexp)
  70. set(handles.checkbox6,'Value',pars.specAnal_driveyp)
  71. % Update handles structure
  72. guidata(hObject, handles);
  73. % UIWAIT makes FlFB_spectralAnalGUI wait for user response (see UIRESUME)
  74. % uiwait(handles.figure1);
  75. % --- Outputs from this function are returned to the command line.
  76. function varargout = FlFB_spectralAnalGUI_OutputFcn(hObject, eventdata, handles)
  77. % varargout cell array for returning output args (see VARARGOUT);
  78. % hObject handle to figure
  79. % eventdata reserved - to be defined in a future version of MATLAB
  80. % handles structure with handles and user data (see GUIDATA)
  81. % Get default command line output from handles structure
  82. varargout{1} = handles.output;
  83. % --- Executes on button press in pushbutton1.
  84. function pushbutton1_Callback(hObject, eventdata, handles) %#ok<*DEFNU,*INUSD>
  85. % hObject handle to pushbutton1 (see GCBO)
  86. % eventdata reserved - to be defined in a future version of MATLAB
  87. % handles structure with handles and user data (see GUIDATA)
  88. guiCloseFn('FlFB_spectralAnalGUI',handles);
  89. % --- Refresh function -> get and display required data
  90. function pushbutton2_Callback(hObject, eventdata, handles)
  91. % hObject handle to pushbutton2 (see GCBO)
  92. % eventdata reserved - to be defined in a future version of MATLAB
  93. % handles structure with handles and user data (see GUIDATA)
  94. persistent freq orbit sorbit ip freq_fb orbit_fb sorbit_fb ip_fb
  95. % Was this called by pushing refresh button?
  96. if get(handles.figure1,'CurrentObject') == hObject || isempty(freq)
  97. refreshPush=true;
  98. else
  99. refreshPush=false;
  100. end
  101. % Set required data buffer length to use
  102. if get(handles.checkbox14,'Value')
  103. newpars.specAnal_npulse=0;
  104. end
  105. FlFB('SetPars',newpars);
  106. % Get data from FlFB and check status
  107. if refreshPush
  108. [stat freq orbit sorbit ip] = FlFB('SpecAnal','GetData');
  109. if stat{1}~=1
  110. errordlg(sprintf('Error getting spectral data from Feedback function: %s',stat{2}),'FlFB Error')
  111. return
  112. end
  113. end
  114. % Set max pulses info
  115. [stat pars]=FlFB('GetPars');
  116. set(handles.text6,'String',sprintf('Npulses (Max %d):',pars.specAnal_npulseAvail))
  117. % Get pars
  118. [stat pars] = FlFB('GetPars');
  119. % Fill data fragmentation box
  120. set(handles.text9,'String',pars.specAnal_frag)
  121. % Get file data if any
  122. fileData=get(hObject,'UserData');
  123. % Get required plane
  124. if get(handles.radiobutton1,'Value')
  125. plane='x';
  126. else
  127. plane='y';
  128. end
  129. % Get required data type
  130. if get(handles.radiobutton3,'Value')
  131. dataType=1;
  132. elseif get(handles.radiobutton4,'Value')
  133. dataType=2;
  134. else
  135. dataType=3;
  136. end
  137. % Get required plots
  138. curMeasDisp=false; fileMeasDisp=false;
  139. curFbDisp=false; fileFbDisp=false;
  140. if get(handles.checkbox1,'Value')
  141. curMeasDisp=true;
  142. end
  143. if get(handles.checkbox2,'Value')
  144. fileMeasDisp=true;
  145. end
  146. if get(handles.checkbox3,'Value')
  147. fileFbDisp=true;
  148. end
  149. if get(handles.checkbox4,'Value')
  150. curFbDisp=true;
  151. end
  152. doPSD=false;
  153. if get(handles.radiobutton8,'Value')
  154. doPSD=true;
  155. wpl=['psd_' plane];
  156. else
  157. wpl=['phi_' plane];
  158. end
  159. df=freq(3)-freq(2);
  160. orbit_int=sqrt(cumsum(orbit.(wpl)(2:end).*df)).*1e9;
  161. sorbit_int=sqrt(cumsum(sorbit.(wpl)(2:end).*df)).*1e9;
  162. ip_int=sqrt(cumsum(ip.(wpl)(2:end).*df)).*1e9;
  163. if ~isempty(fileData)
  164. df_file=fileData(dataType).freq(3)-fileData(dataType).freq(2);
  165. fileData_int(dataType).(wpl)=cumsum(fileData(dataType).(wpl)(2:end).*df_file);
  166. end
  167. if length(fileData)>3
  168. df_file_fb=fileData(dataType+3).freq(3)-fileData(dataType+3).freq(2);
  169. fileData_int(3+dataType).(wpl)=cumsum(fileData(3+dataType).(wpl)(2:end).*df_file_fb);
  170. end
  171. if refreshPush || isempty(freq_fb)
  172. [stat freq_fb orbit_fb sorbit_fb ip_fb] = FlFB('SpecAnal','FBTF');
  173. if stat{1}~=1
  174. errordlg(sprintf('Error getting spectral data from Feedback function: %s',stat{2}),'FlFB Error')
  175. return
  176. end
  177. end
  178. df_fb=freq_fb(3)-freq_fb(2);
  179. orbit_fb_int=sqrt(cumsum(orbit_fb(2).(wpl)(2:end).*df_fb)).*1e9;
  180. sorbit_fb_int=sqrt(cumsum(sorbit_fb(2).(wpl)(2:end).*df_fb)).*1e9;
  181. ip_fb_int=sqrt(cumsum(ip_fb(2).(wpl)(2:end).*df_fb)).*1e9;
  182. % Form TF's in dB
  183. if doPSD
  184. tf_orbit=10*log10(orbit_fb(2).(wpl))-10*log10(orbit_fb(1).(wpl));
  185. tf_sorbit=10*log10(sorbit_fb(2).(wpl))-10*log10(sorbit_fb(1).(wpl));
  186. tf_ip=10*log10(ip_fb(2).(wpl))-10*log10(ip_fb(1).(wpl));
  187. else
  188. tf_orbit=orbit_fb(2).(wpl)-orbit_fb(1).(wpl);
  189. tf_sorbit=sorbit_fb(2).(wpl)-sorbit_fb(1).(wpl);
  190. tf_ip=ip_fb(2).(wpl)-ip_fb(1).(wpl);
  191. end
  192. % Get data to plot
  193. cla(handles.axes1)
  194. cla(handles.axes2)
  195. xpl1={}; ypl1={};
  196. xpl2={}; ypl2={}; pf={}; col={};
  197. if curMeasDisp
  198. xpl1{1}=freq(2:end);
  199. xpl2{1}=freq(2:end);
  200. if dataType==1
  201. ypl1{1}=orbit_int;
  202. ypl2{1}=orbit.(wpl)(2:end);
  203. elseif dataType==2
  204. ypl1{1}=sorbit_int;
  205. ypl2{1}=sorbit.(wpl)(2:end);
  206. else
  207. ypl1{1}=ip_int;
  208. ypl2{1}=ip.(wpl)(2:end);
  209. end
  210. pf{1}='loglog';
  211. col{1}='blue';
  212. end
  213. if fileMeasDisp
  214. xpl2{end+1}=fileData(dataType).freq(2:end);
  215. ypl2{end+1}=fileData(dataType).(wpl)(2:end);
  216. xpl1{end+1}=fileData(dataType).freq(2:end);
  217. ypl1{end+1}=fileData_int(dataType).(wpl);
  218. pf{end+1}='loglog';
  219. col{end+1}='black';
  220. end
  221. if curFbDisp
  222. xpl1{end+1}=freq_fb(2:end);
  223. xpl2{end+1}=freq_fb(2:end);
  224. if dataType==1
  225. ypl2{end+1}=tf_orbit.(plane)(2:end);
  226. ypl1{end+1}=orbit_fb_int;
  227. elseif dataType==2
  228. ypl2{end+1}=tf_sorbit.(plane)(2:end);
  229. ypl1{end+1}=sorbit_fb_int;
  230. else
  231. ypl2{end+1}=tf_ip.(plane)(2:end);
  232. ypl1{end+1}=ip_fb_int;
  233. end
  234. pf{end+1}='semilogx';
  235. col{end+1}='red';
  236. end
  237. if fileFbDisp
  238. xpl1{end+1}=fileData(dataType+3).freq(2:end);
  239. xpl2{end+1}=fileData(dataType+3).freq(2:end);
  240. ypl2{end+1}=fileData(dataType+3).(wpl)(2:end);
  241. ypl1{end+1}=fileData_int(dataType+3).(wpl);
  242. pf{end+1}='semilogx';
  243. col{end+1}='magenta';
  244. end
  245. % perform plotting
  246. [ax,h1,h2]=plotyy(handles.axes1,xpl1{1},ypl1{1},xpl1{2},ypl1{2},'loglog');
  247. set(h1,'Color',col{1}); set(h2,'Color',col{2});
  248. if doPSD
  249. [ax,h1,h2]=plotyy(handles.axes2,xpl2{1},ypl2{1},xpl2{2},ypl2{2},pf{1},pf{2});
  250. set(h1,'Color',col{1}); set(h2,'Color',col{2});
  251. else
  252. [ax,h1,h2]=plotyy(handles.axes2,xpl2{1},ypl2{1},xpl2{2},ypl2{2});
  253. set(h1,'Color',col{1}); set(h2,'Color',col{2});
  254. end
  255. % Display integrated noise data
  256. f0=str2double(regexp(get(handles.uipanel10,'title'),'\d+\.?(\d+)?','match'));
  257. [X I]=min(abs(freq-f0));
  258. [X I_fb]=min(abs(freq_fb-f0));
  259. if dataType==1
  260. set(handles.text13,'String',num2str(orbit_fb_int(I_fb-1)))
  261. elseif dataType==2
  262. set(handles.text13,'String',num2str(sorbit_fb_int(I_fb-1)))
  263. else
  264. set(handles.text13,'String',num2str(ip_fb_int(I_fb-1)))
  265. end
  266. if dataType==1
  267. set(handles.text11,'String',num2str(orbit_int(I-1)))
  268. elseif dataType==2
  269. set(handles.text11,'String',num2str(sorbit_int(I-1)))
  270. else
  271. set(handles.text11,'String',num2str(ip_int(I-1)))
  272. end
  273. if ~isempty(fileData)
  274. [X I]=min(abs(fileData(dataType).freq-f0));
  275. set(handles.text12,'String',num2str(fileData_int(dataType).(wpl)(I-1)))
  276. if length(fileData)>3
  277. [X I_fb]=min(abs(fileData(dataType+3).freq-f0));
  278. set(handles.text14,'String',num2str(fileData_int(dataType+3).(wpl)(I_fb-1)))
  279. else
  280. set(handles.text14,'String','---')
  281. end
  282. else
  283. set(handles.text12,'String','---')
  284. set(handles.text14,'String','---')
  285. end
  286. % Write save file data to save button UserData for saving
  287. if refreshPush
  288. fileData_save(1).psd_x=orbit.psd_x;
  289. fileData_save(2).psd_x=sorbit.psd_x;
  290. fileData_save(3).psd_x=ip.psd_x;
  291. fileData_save(1).psd_y=orbit.psd_y;
  292. fileData_save(2).psd_y=sorbit.psd_y;
  293. fileData_save(3).psd_y=ip.psd_y;
  294. fileData_save(1).phase_x=orbit.phase_x;
  295. fileData_save(2).phase_x=sorbit.phase_x;
  296. fileData_save(3).phase_x=ip.phase_x;
  297. fileData_save(1).phase_y=orbit.phase_y;
  298. fileData_save(2).phase_y=sorbit.phase_y;
  299. fileData_save(3).phase_y=ip.phase_y;
  300. for ind=1:3
  301. fileData_save(ind).freq=freq;
  302. end
  303. fileData_save(4).psd_x=orbit_fb(2).psd_x;
  304. fileData_save(5).psd_x=sorbit_fb(2).psd_x;
  305. fileData_save(6).psd_x=ip_fb(2).psd_x;
  306. fileData_save(4).psd_y=orbit_fb(2).psd_y;
  307. fileData_save(5).psd_y=sorbit_fb(2).psd_y;
  308. fileData_save(6).psd_y=ip_fb(2).psd_y;
  309. fileData_save(4).phase_x=orbit_fb(2).phase_x;
  310. fileData_save(5).phase_x=sorbit_fb(2).phase_x;
  311. fileData_save(6).phase_x=ip_fb(2).phase_x;
  312. fileData_save(4).phase_y=orbit_fb(2).phase_y;
  313. fileData_save(5).phase_y=sorbit_fb(2).phase_y;
  314. fileData_save(6).phase_y=ip_fb(2).phase_y;
  315. for ind=4:6
  316. fileData_save(ind).freq=freq_fb;
  317. end
  318. set(handles.pushbutton5,'UserData',fileData_save)
  319. end
  320. % --- Executes on button press in pushbutton3.
  321. function pushbutton3_Callback(hObject, eventdata, handles)
  322. % hObject handle to pushbutton3 (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. % --- Executes on slider movement.
  326. function slider1_Callback(hObject, eventdata, handles)
  327. % hObject handle to slider1 (see GCBO)
  328. % eventdata reserved - to be defined in a future version of MATLAB
  329. % handles structure with handles and user data (see GUIDATA)
  330. % Hints: get(hObject,'Value') returns position of slider
  331. % get(hObject,'Min') and get(hObject,'Max') to determine range of slider
  332. % --- Executes during object creation, after setting all properties.
  333. function slider1_CreateFcn(hObject, eventdata, handles)
  334. % hObject handle to slider1 (see GCBO)
  335. % eventdata reserved - to be defined in a future version of MATLAB
  336. % handles empty - handles not created until after all CreateFcns called
  337. % Hint: slider controls usually have a light gray background.
  338. if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  339. set(hObject,'BackgroundColor',[.9 .9 .9]);
  340. end
  341. % --- Executes on button press in radiobutton3.
  342. function radiobutton3_Callback(hObject, eventdata, handles)
  343. % hObject handle to radiobutton3 (see GCBO)
  344. % eventdata reserved - to be defined in a future version of MATLAB
  345. % handles structure with handles and user data (see GUIDATA)
  346. set(handles.radiobutton4,'Value',false)
  347. set(handles.radiobutton5,'Value',false)
  348. set(hObject,'Value',true)
  349. pushbutton2_Callback(handles.pushbutton2,[],handles);
  350. % --- Executes on button press in radiobutton4.
  351. function radiobutton4_Callback(hObject, eventdata, handles)
  352. % hObject handle to radiobutton4 (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. set(handles.radiobutton3,'Value',false)
  356. set(handles.radiobutton5,'Value',false)
  357. set(hObject,'Value',true)
  358. pushbutton2_Callback(handles.pushbutton2,[],handles);
  359. % --- Executes on button press in radiobutton5.
  360. function radiobutton5_Callback(hObject, eventdata, handles)
  361. % hObject handle to radiobutton5 (see GCBO)
  362. % eventdata reserved - to be defined in a future version of MATLAB
  363. % handles structure with handles and user data (see GUIDATA)
  364. set(handles.radiobutton4,'Value',false)
  365. set(handles.radiobutton3,'Value',false)
  366. set(hObject,'Value',true)
  367. pushbutton2_Callback(handles.pushbutton2,[],handles);
  368. % --- Executes on button press in radiobutton1.
  369. function radiobutton1_Callback(hObject, eventdata, handles)
  370. % hObject handle to radiobutton1 (see GCBO)
  371. % eventdata reserved - to be defined in a future version of MATLAB
  372. % handles structure with handles and user data (see GUIDATA)
  373. if get(hObject,'Value')
  374. set(handles.radiobutton2,'Value',false)
  375. else
  376. set(handles.radiobutton2,'Value',true)
  377. end
  378. pushbutton2_Callback(handles.pushbutton2,[],handles);
  379. % --- Executes on button press in radiobutton2.
  380. function radiobutton2_Callback(hObject, eventdata, handles)
  381. % hObject handle to radiobutton2 (see GCBO)
  382. % eventdata reserved - to be defined in a future version of MATLAB
  383. % handles structure with handles and user data (see GUIDATA)
  384. if get(hObject,'Value')
  385. set(handles.radiobutton1,'Value',false)
  386. else
  387. set(handles.radiobutton1,'Value',true)
  388. end
  389. pushbutton2_Callback(handles.pushbutton2,[],handles);
  390. % --- Executes on selection change in popupmenu1.
  391. function popupmenu1_Callback(hObject, eventdata, handles)
  392. % hObject handle to popupmenu1 (see GCBO)
  393. % eventdata reserved - to be defined in a future version of MATLAB
  394. % handles structure with handles and user data (see GUIDATA)
  395. % Hints: contents = cellstr(get(hObject,'String')) returns popupmenu1 contents as cell array
  396. % contents{get(hObject,'Value')} returns selected item from popupmenu1
  397. % --- Executes during object creation, after setting all properties.
  398. function popupmenu1_CreateFcn(hObject, eventdata, handles)
  399. % hObject handle to popupmenu1 (see GCBO)
  400. % eventdata reserved - to be defined in a future version of MATLAB
  401. % handles empty - handles not created until after all CreateFcns called
  402. % Hint: popupmenu controls usually have a white background on Windows.
  403. % See ISPC and COMPUTER.
  404. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  405. set(hObject,'BackgroundColor','white');
  406. end
  407. function edit1_Callback(hObject, eventdata, handles)
  408. % hObject handle to edit1 (see GCBO)
  409. % eventdata reserved - to be defined in a future version of MATLAB
  410. % handles structure with handles and user data (see GUIDATA)
  411. % Hints: get(hObject,'String') returns contents of edit1 as text
  412. % str2double(get(hObject,'String')) returns contents of edit1 as a double
  413. % --- Executes during object creation, after setting all properties.
  414. function edit1_CreateFcn(hObject, eventdata, handles)
  415. % hObject handle to edit1 (see GCBO)
  416. % eventdata reserved - to be defined in a future version of MATLAB
  417. % handles empty - handles not created until after all CreateFcns called
  418. % Hint: edit controls usually have a white background on Windows.
  419. % See ISPC and COMPUTER.
  420. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  421. set(hObject,'BackgroundColor','white');
  422. end
  423. % --- Executes on button press in pushbutton5.
  424. function pushbutton5_Callback(hObject, eventdata, handles)
  425. % hObject handle to pushbutton5 (see GCBO)
  426. % eventdata reserved - to be defined in a future version of MATLAB
  427. % handles structure with handles and user data (see GUIDATA)
  428. [fn pn]=uiputfile(sprintf('userData/FlFB_spectralAnal_%s.mat',datestr(now,30)),'Save Data File');
  429. if fn
  430. saveData=get(hObject,'UserData');
  431. save(fullfile(pn,fn),saveData);
  432. end
  433. % --- Executes on button press in pushbutton6.
  434. function pushbutton6_Callback(hObject, eventdata, handles)
  435. % hObject handle to pushbutton6 (see GCBO)
  436. % eventdata reserved - to be defined in a future version of MATLAB
  437. % handles structure with handles and user data (see GUIDATA)
  438. [fn pn]=uigetfile('userData/FlFB_spectralAnal*.mat','Get Data File');
  439. if fn
  440. load(fullfile(pn,fn))
  441. set(handles.pushbutton2,'UserData',saveData)
  442. finfo=dir(fullfile(pn,fn));
  443. set(handles.text2,'String',sprintf('%s\n%s',fn,finfo.date));
  444. end
  445. % --- Executes on button press in radiobutton6.
  446. function radiobutton6_Callback(hObject, eventdata, handles)
  447. % hObject handle to radiobutton6 (see GCBO)
  448. % eventdata reserved - to be defined in a future version of MATLAB
  449. % handles structure with handles and user data (see GUIDATA)
  450. % Hint: get(hObject,'Value') returns toggle state of radiobutton6
  451. % --- Executes on button press in radiobutton7.
  452. function radiobutton7_Callback(hObject, eventdata, handles)
  453. % hObject handle to radiobutton7 (see GCBO)
  454. % eventdata reserved - to be defined in a future version of MATLAB
  455. % handles structure with handles and user data (see GUIDATA)
  456. % Hint: get(hObject,'Value') returns toggle state of radiobutton7
  457. % --- Executes on button press in checkbox1.
  458. function checkbox1_Callback(hObject, eventdata, handles)
  459. % hObject handle to checkbox1 (see GCBO)
  460. % eventdata reserved - to be defined in a future version of MATLAB
  461. % handles structure with handles and user data (see GUIDATA)
  462. if get(hObject,'Value')
  463. setDisplayCB(1,handles);
  464. else
  465. set(hObject,'Value',true)
  466. end
  467. % --- Executes on button press in checkbox2.
  468. function checkbox2_Callback(hObject, eventdata, handles)
  469. % hObject handle to checkbox2 (see GCBO)
  470. % eventdata reserved - to be defined in a future version of MATLAB
  471. % handles structure with handles and user data (see GUIDATA)
  472. if get(hObject,'Value')
  473. if isempty(get(handles.pushbutton2,'UserData'))
  474. errordlg('No file data loaded','Selection Error');
  475. set(hObject,'Value',false)
  476. return
  477. end
  478. setDisplayCB(2,handles);
  479. else
  480. set(hObject,'Value',true)
  481. end
  482. % --- Executes on button press in checkbox3.
  483. function checkbox3_Callback(hObject, eventdata, handles)
  484. % hObject handle to checkbox3 (see GCBO)
  485. % eventdata reserved - to be defined in a future version of MATLAB
  486. % handles structure with handles and user data (see GUIDATA)
  487. if get(hObject,'Value')
  488. if isempty(get(handles.pushbutton2,'UserData'))
  489. errordlg('No file data loaded','Selection Error');
  490. set(hObject,'Value',false)
  491. return
  492. end
  493. setDisplayCB(3,handles);
  494. else
  495. set(hObject,'Value',true)
  496. end
  497. % --- Executes on button press in checkbox4.
  498. function checkbox4_Callback(hObject, eventdata, handles)
  499. % hObject handle to checkbox4 (see GCBO)
  500. % eventdata reserved - to be defined in a future version of MATLAB
  501. % handles structure with handles and user data (see GUIDATA)
  502. if get(hObject,'Value')
  503. setDisplayCB(4,handles);
  504. else
  505. set(hObject,'Value',true)
  506. end
  507. function setDisplayCB(wCB,handles)
  508. persistent lastCB
  509. curCB=false(1,4);
  510. for iCB=1:4
  511. curCB(iCB)=get(handles.(sprintf('checkbox%d',iCB)),'Value');
  512. end
  513. curCB(wCB)=false;
  514. if isempty(lastCB)
  515. lastCB=find(curCB, 1, 'first' );
  516. end
  517. curCB(lastCB)=false;
  518. for iCB=find(curCB)
  519. set(handles.(sprintf('checkbox%d',iCB)),'Value',false)
  520. end
  521. pushbutton2_Callback(handles.pushbutton2,[],handles);
  522. % --- Executes on button press in checkbox10.
  523. function checkbox10_Callback(hObject, eventdata, handles)
  524. % hObject handle to checkbox10 (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. % Hint: get(hObject,'Value') returns toggle state of checkbox10
  528. % --- Executes on button press in checkbox11.
  529. function checkbox11_Callback(hObject, eventdata, handles)
  530. % hObject handle to checkbox11 (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. % Hint: get(hObject,'Value') returns toggle state of checkbox11
  534. % --- Executes on button press in checkbox5.
  535. function checkbox5_Callback(hObject, eventdata, handles)
  536. % hObject handle to checkbox5 (see GCBO)
  537. % eventdata reserved - to be defined in a future version of MATLAB
  538. % handles structure with handles and user data (see GUIDATA)
  539. newpars.specAnal_drivexp=get(hObject,'Value');
  540. FlFB('SetPars',newpars);
  541. % --- Executes on button press in checkbox6.
  542. function checkbox6_Callback(hObject, eventdata, handles)
  543. % hObject handle to checkbox6 (see GCBO)
  544. % eventdata reserved - to be defined in a future version of MATLAB
  545. % handles structure with handles and user data (see GUIDATA)
  546. newpars.specAnal_driveyp=get(hObject,'Value');
  547. FlFB('SetPars',newpars);
  548. % --- Executes on button press in checkbox7.
  549. function checkbox7_Callback(hObject, eventdata, handles)
  550. % hObject handle to checkbox7 (see GCBO)
  551. % eventdata reserved - to be defined in a future version of MATLAB
  552. % handles structure with handles and user data (see GUIDATA)
  553. newpars.specAnal_drivee=get(hObject,'Value');
  554. FlFB('SetPars',newpars);
  555. % --- Executes on button press in checkbox8.
  556. function checkbox8_Callback(hObject, eventdata, handles)
  557. % hObject handle to checkbox8 (see GCBO)
  558. % eventdata reserved - to be defined in a future version of MATLAB
  559. % handles structure with handles and user data (see GUIDATA)
  560. newpars.specAnal_drivex=get(hObject,'Value');
  561. FlFB('SetPars',newpars);
  562. % --- Executes on button press in checkbox9.
  563. function checkbox9_Callback(hObject, eventdata, handles)
  564. % hObject handle to checkbox9 (see GCBO)
  565. % eventdata reserved - to be defined in a future version of MATLAB
  566. % handles structure with handles and user data (see GUIDATA)
  567. newpars.specAnal_drivey=get(hObject,'Value');
  568. FlFB('SetPars',newpars);
  569. % --- Executes on button press in checkbox12.
  570. function checkbox12_Callback(hObject, eventdata, handles)
  571. % hObject handle to checkbox12 (see GCBO)
  572. % eventdata reserved - to be defined in a future version of MATLAB
  573. % handles structure with handles and user data (see GUIDATA)
  574. % Hint: get(hObject,'Value') returns toggle state of checkbox12
  575. % --- Executes on button press in checkbox13.
  576. function checkbox13_Callback(hObject, eventdata, handles)
  577. % hObject handle to checkbox13 (see GCBO)
  578. % eventdata reserved - to be defined in a future version of MATLAB
  579. % handles structure with handles and user data (see GUIDATA)
  580. % Hint: get(hObject,'Value') returns toggle state of checkbox13
  581. function edit2_Callback(hObject, eventdata, handles)
  582. % hObject handle to edit2 (see GCBO)
  583. % eventdata reserved - to be defined in a future version of MATLAB
  584. % handles structure with handles and user data (see GUIDATA)
  585. % Hints: get(hObject,'String') returns contents of edit2 as text
  586. % str2double(get(hObject,'String')) returns contents of edit2 as a double
  587. % --- Executes during object creation, after setting all properties.
  588. function edit2_CreateFcn(hObject, eventdata, handles)
  589. % hObject handle to edit2 (see GCBO)
  590. % eventdata reserved - to be defined in a future version of MATLAB
  591. % handles empty - handles not created until after all CreateFcns called
  592. % Hint: edit controls usually have a white background on Windows.
  593. % See ISPC and COMPUTER.
  594. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  595. set(hObject,'BackgroundColor','white');
  596. end
  597. % --- Executes on selection change in popupmenu2.
  598. function popupmenu2_Callback(hObject, eventdata, handles)
  599. % hObject handle to popupmenu2 (see GCBO)
  600. % eventdata reserved - to be defined in a future version of MATLAB
  601. % handles structure with handles and user data (see GUIDATA)
  602. % Hints: contents = cellstr(get(hObject,'String')) returns popupmenu2 contents as cell array
  603. % contents{get(hObject,'Value')} returns selected item from popupmenu2
  604. % --- Executes during object creation, after setting all properties.
  605. function popupmenu2_CreateFcn(hObject, eventdata, handles)
  606. % hObject handle to popupmenu2 (see GCBO)
  607. % eventdata reserved - to be defined in a future version of MATLAB
  608. % handles empty - handles not created until after all CreateFcns called
  609. % Hint: popupmenu controls usually have a white background on Windows.
  610. % See ISPC and COMPUTER.
  611. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  612. set(hObject,'BackgroundColor','white');
  613. end
  614. function edit3_Callback(hObject, eventdata, handles)
  615. % hObject handle to edit3 (see GCBO)
  616. % eventdata reserved - to be defined in a future version of MATLAB
  617. % handles structure with handles and user data (see GUIDATA)
  618. % Hints: get(hObject,'String') returns contents of edit3 as text
  619. % str2double(get(hObject,'String')) returns contents of edit3 as a double
  620. % --- Executes during object creation, after setting all properties.
  621. function edit3_CreateFcn(hObject, eventdata, handles)
  622. % hObject handle to edit3 (see GCBO)
  623. % eventdata reserved - to be defined in a future version of MATLAB
  624. % handles empty - handles not created until after all CreateFcns called
  625. % Hint: edit controls usually have a white background on Windows.
  626. % See ISPC and COMPUTER.
  627. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  628. set(hObject,'BackgroundColor','white');
  629. end
  630. function edit4_Callback(hObject, eventdata, handles)
  631. % hObject handle to edit4 (see GCBO)
  632. % eventdata reserved - to be defined in a future version of MATLAB
  633. % handles structure with handles and user data (see GUIDATA)
  634. val=round(str2double(get(hObject,'String')));
  635. [stat pars]=FlFB('GetPars');
  636. if isnan(val) || val<0
  637. set(hObject,'String',num2str(pars.specAnal_npulse))
  638. else
  639. newpars.specAnal_npulse=val;
  640. FlFB('SetPars',newpars);
  641. pushbutton2_Callback(handles.pushbutton2,[],handles);
  642. end
  643. % --- Executes during object creation, after setting all properties.
  644. function edit4_CreateFcn(hObject, eventdata, handles)
  645. % hObject handle to edit4 (see GCBO)
  646. % eventdata reserved - to be defined in a future version of MATLAB
  647. % handles empty - handles not created until after all CreateFcns called
  648. % Hint: edit controls usually have a white background on Windows.
  649. % See ISPC and COMPUTER.
  650. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  651. set(hObject,'BackgroundColor','white');
  652. end
  653. function edit5_Callback(hObject, eventdata, handles)
  654. % hObject handle to edit5 (see GCBO)
  655. % eventdata reserved - to be defined in a future version of MATLAB
  656. % handles structure with handles and user data (see GUIDATA)
  657. val=round(str2double(get(hObject,'String')));
  658. [stat pars]=FlFB('GetPars');
  659. if isnan(val) || val<0 || val>100000
  660. set(hObject,'String',num2str(pars.specAnal_nsimTrack))
  661. else
  662. newpars.specAnal_nsimTrack=val;
  663. FlFB('SetPars',newpars);
  664. end
  665. % --- Executes during object creation, after setting all properties.
  666. function edit5_CreateFcn(hObject, eventdata, handles)
  667. % hObject handle to edit5 (see GCBO)
  668. % eventdata reserved - to be defined in a future version of MATLAB
  669. % handles empty - handles not created until after all CreateFcns called
  670. % Hint: edit controls usually have a white background on Windows.
  671. % See ISPC and COMPUTER.
  672. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  673. set(hObject,'BackgroundColor','white');
  674. end
  675. % --- Executes on button press in radiobutton8.
  676. function radiobutton8_Callback(hObject, eventdata, handles)
  677. % hObject handle to radiobutton8 (see GCBO)
  678. % eventdata reserved - to be defined in a future version of MATLAB
  679. % handles structure with handles and user data (see GUIDATA)
  680. if get(hObject,'Value')
  681. set(handles.radiobutton9,'Value',false)
  682. else
  683. set(handles.radiobutton9,'Value',true)
  684. end
  685. pushbutton2_Callback(handles.pushbutton2,[],handles);
  686. % --- Executes on button press in radiobutton9.
  687. function radiobutton9_Callback(hObject, eventdata, handles)
  688. % hObject handle to radiobutton9 (see GCBO)
  689. % eventdata reserved - to be defined in a future version of MATLAB
  690. % handles structure with handles and user data (see GUIDATA)
  691. if get(hObject,'Value')
  692. set(handles.radiobutton8,'Value',false)
  693. else
  694. set(handles.radiobutton8,'Value',true)
  695. end
  696. pushbutton2_Callback(handles.pushbutton2,[],handles);
  697. % --- Executes on button press in checkbox14.
  698. function checkbox14_Callback(hObject, eventdata, handles)
  699. % hObject handle to checkbox14 (see GCBO)
  700. % eventdata reserved - to be defined in a future version of MATLAB
  701. % handles structure with handles and user data (see GUIDATA)
  702. % --- Executes on mouse press over axes background.
  703. function axes1_ButtonDownFcn(hObject, eventdata, handles)
  704. % hObject handle to axes1 (see GCBO)
  705. % eventdata reserved - to be defined in a future version of MATLAB
  706. % handles structure with handles and user data (see GUIDATA)
  707. cp=get(gca,'CurrentPoint');
  708. set(handles.uipanel10,'Title',sprintf('RMS Integrated Noise > %.2f Hz / nm',cp(1)))
  709. % --- Executes when user attempts to close figure1.
  710. function figure1_CloseRequestFcn(hObject, eventdata, handles)
  711. % hObject handle to figure1 (see GCBO)
  712. % eventdata reserved - to be defined in a future version of MATLAB
  713. % handles structure with handles and user data (see GUIDATA)
  714. guiCloseFn('FlFB_spectralAnalGUI',handles);