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

/src/gui/BeamlineViewer.m

http://slac-lucretia.googlecode.com/
MATLAB | 1271 lines | 731 code | 212 blank | 328 comment | 146 complexity | e04391b6de56fdec00b84d507d57949f MD5 | raw file
Possible License(s): BSD-2-Clause
  1. function varargout = BeamlineViewer(varargin)
  2. %
  3. % BEAMLINEVIEWER Create a graphical user interface (GUI) viewer for
  4. % Lucretia beamline data structures.
  5. %
  6. % BeamlineViewer( ) creates a GUI viewer for viewing Lucretia BEAMLINE,
  7. % GIRDER, KLYSTRON, and PS data. The viewer allows users to scroll
  8. % through any of the aforementioned data structures and view the full
  9. % data fields of any one beamline element, girder, klystron or power
  10. % supply. Searches of the BEAMLINE cell array are supported. Clicking
  11. % on Element, Girder, Klystron, PS, Block, or Slices fields in the
  12. % detailed display brings up or highlights the relevant data objects.
  13. % Visually scroll through the beamline elements using the viewer,
  14. % clicking on magnet elements highlights them in the listboxes below
  15. % To be able to use the Twiss/bpm plotting functions, pass a Lucretia
  16. % Initial and/or Beam structure : BeamlineViewer(Initial,Beam)
  17. % -------------------------------------------------------
  18. %
  19. % Version date: 26-Sept-2008.
  20. %==========================================================================
  21. %
  22. % Here we have all the code which Matlab uses to manage the GUI itself at
  23. % the lowest level: respond to button pushes, initialize, etc.
  24. %
  25. %==========================================================================
  26. % Last Modified by GUIDE v2.5 26-Sep-2008 16:30:40
  27. % Begin initialization code - DO NOT EDIT
  28. gui_Singleton = 1;
  29. gui_State = struct('gui_Name', mfilename, ...
  30. 'gui_Singleton', gui_Singleton, ...
  31. 'gui_OpeningFcn', @BeamlineViewer_OpeningFcn, ...
  32. 'gui_OutputFcn', @BeamlineViewer_OutputFcn, ...
  33. 'gui_LayoutFcn', [] , ...
  34. 'gui_Callback', []);
  35. if nargin && ischar(varargin{1})
  36. gui_State.gui_Callback = str2func(varargin{1});
  37. end
  38. if nargout
  39. [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
  40. else
  41. gui_mainfcn(gui_State, varargin{:});
  42. end
  43. % End initialization code - DO NOT EDIT
  44. %==========================================================================
  45. function BeamlineViewer_OpeningFcn(hObject, eventdata, handles, varargin) %#ok<*INUSL>
  46. %
  47. % This function has no output args, see OutputFcn. It executes immediately
  48. % prior to the Beamline Viewer being displayed to the user.
  49. %
  50. % Input Arguments:
  51. % hObject handle to figure
  52. % eventdata reserved - to be defined in a future version of MATLAB
  53. % handles structure with handles and user data (see GUIDATA)
  54. % varargin command line arguments to BeamlineViewer (see VARARGIN)
  55. % data field to remember which bit of data is displayed in the detailed
  56. % view window
  57. global INSTR FL
  58. handles.DisplayedElement = 0 ;
  59. handles.DisplayType = 0 ;
  60. % Update handles structure with the DisplayedElement field
  61. guidata(hObject, handles);
  62. % populate listbox and set status based on success or failure
  63. status = GetBeamline(handles) ;
  64. handles = guidata(hObject) ;
  65. if isempty(FL)
  66. handles.output = status ;
  67. else
  68. handles.output = handles ;
  69. end % if using Floodland environment
  70. guidata(hObject, handles);
  71. % on failure (due to problems with the BEAMLINE array) do the following:
  72. if (status == 0)
  73. beep
  74. msgbox('Global cell array BEAMLINE is empty', ...
  75. 'Beamline Viewer Error','error','modal') ;
  76. return ;
  77. elseif (status == -1)
  78. beep
  79. msgbox('Global cell array BEAMLINE is malformed', ...
  80. 'Beamline Viewer Error','error','modal') ;
  81. return ;
  82. end
  83. % clear the element display and the detailed display
  84. DisplayElement(handles,0,0) ;
  85. AuxDisplay(handles,0) ;
  86. % Floodland-specific functions
  87. if isempty(INSTR)
  88. set(handles.pushbutton7,'Visible','off');
  89. else
  90. set(handles.pushbutton7,'Visible','on');
  91. end % if INSTR global filled
  92. if isempty(FL)
  93. set(handles.pushbutton8,'Visible','off');
  94. set(handles.pushbutton9,'Visible','off');
  95. set(handles.pushbutton10,'Visible','off');
  96. set(handles.popupmenu3,'String',{'All'});
  97. else
  98. set(handles.pushbutton8,'Visible','on');
  99. set(handles.pushbutton9,'Visible','on');
  100. set(handles.pushbutton10,'Visible','on');
  101. if isfield(FL,'Section')
  102. sections=fieldnames(FL.Section);
  103. if ~isempty(sections)
  104. secs=get(handles.popupmenu3,'String');
  105. for isec=1:length(sections)
  106. secs{end+1}=sections{isec};
  107. end % for isec
  108. set(handles.popupmenu3,'String',secs);
  109. end % if ~empty secs
  110. end % if FL.Section
  111. end % if FL global filled
  112. if length(varargin)==1
  113. plotFunc(handles,'init',varargin{1});
  114. elseif length(varargin)==2
  115. plotFunc(handles,'init',varargin{1},varargin{2});
  116. else
  117. plotFunc(handles,'init')
  118. end % if passed Initial and/or Beam info
  119. %==========================================================================
  120. function varargout = BeamlineViewer_OutputFcn(hObject, eventdata, handles)
  121. %
  122. % Function which executes on exit from the BeamlineViewer GUI
  123. %
  124. % Output arguments:
  125. % varargout cell array for returning output args (see VARARGOUT);
  126. %
  127. % Input arguments:
  128. % hObject handle to figure
  129. % eventdata reserved - to be defined in a future version of MATLAB
  130. % handles structure with handles and user data (see GUIDATA)
  131. varargout{1} = handles.output;
  132. if ( (isnumeric(handles.output)) && (handles.output ~= 1) )
  133. delete(handles.figure1) ;
  134. end
  135. varargout{2}=[];
  136. %==========================================================================
  137. function listbox1_Callback(hObject, eventdata, handles)
  138. %
  139. % Function which executes when the selection in the Beamline listbox has
  140. % changed
  141. %
  142. % Input arguments:
  143. % hObject handle to listbox1 (see GCBO)
  144. % eventdata reserved - to be defined in a future version of MATLAB
  145. % handles structure with handles and user data (see GUIDATA)
  146. % On a double-click, get the element number and display that BEAMLINE
  147. % member in the detailed display box
  148. if (strcmp(get(handles.figure1,'SelectionType'),'open')) || (~isempty(eventdata) && eventdata==2)
  149. eptr = get(handles.listbox1,'Value') ;
  150. DisplayElement(handles,eptr,0) ;
  151. plotFunc(handles,'init');
  152. set(handles.slider1,'Value',eptr);
  153. slider1_Callback(handles.slider1, eventdata, handles);
  154. end
  155. %==========================================================================
  156. function listbox1_CreateFcn(hObject, eventdata, handles) %#ok<*INUSD,*DEFNU>
  157. %
  158. % Function which executes on creation of the beamline listbox
  159. %
  160. % Input arguments:
  161. % hObject handle to listbox1 (see GCBO)
  162. % eventdata reserved - to be defined in a future version of MATLAB
  163. % handles empty - handles not created until after all CreateFcns called
  164. if ispc && isequal(get(hObject,'BackgroundColor'), ...
  165. get(0,'defaultUicontrolBackgroundColor'))
  166. set(hObject,'BackgroundColor','white');
  167. end
  168. %==========================================================================
  169. function listbox2_Callback(hObject, eventdata, handles)
  170. %
  171. % Function manages the activity when the user selects a line in the
  172. % detailed display.
  173. %
  174. % Input arguments:
  175. % hObject handle to listbox2 (see GCBO)
  176. % eventdata reserved - to be defined in a future version of MATLAB
  177. % handles structure with handles and user data (see GUIDATA)
  178. global BEAMLINE GIRDER KLYSTRON PS
  179. if (strcmp(get(handles.figure1,'SelectionType'),'open')) || ~isempty(eventdata);
  180. SelectLine = get(handles.listbox2,'Value') ;
  181. ielem = handles.DisplayedElement ;
  182. % we do different things depending on whether it's an element display or a
  183. % display of one of the other types
  184. switch handles.DisplayType
  185. case 0 % element is displayed
  186. switch SelectLine
  187. case handles.Gptr
  188. if (BEAMLINE{ielem}.Girder ~= 0)
  189. AuxDisplay(handles,1) ;
  190. handles.AuxDisp = 1 ;
  191. set(handles.listbox3,'Value',BEAMLINE{ielem}.Girder) ;
  192. DisplayElement(handles,BEAMLINE{ielem}.Girder,1) ;
  193. end
  194. case handles.Kptr
  195. if (BEAMLINE{ielem}.Klystron ~= 0)
  196. AuxDisplay(handles,2) ;
  197. handles.AuxDisp = 2 ;
  198. set(handles.listbox3,'Value',BEAMLINE{ielem}.Klystron) ;
  199. DisplayElement(handles,BEAMLINE{ielem}.Klystron,2) ;
  200. end
  201. case handles.Pptr
  202. if (BEAMLINE{ielem}.PS ~= 0)
  203. AuxDisplay(handles,3) ;
  204. handles.AuxDisp = 3 ;
  205. set(handles.listbox3,'Value',BEAMLINE{ielem}.PS(1)) ;
  206. DisplayElement(handles,BEAMLINE{ielem}.PS(1),3) ;
  207. end
  208. case handles.Bptr
  209. set(handles.listbox1,'Value',...
  210. BEAMLINE{ielem}.Block(1):BEAMLINE{ielem}.Block(2)) ;
  211. case handles.Sptr
  212. set(handles.listbox1,'Value',BEAMLINE{ielem}.Slices) ;
  213. end
  214. case {1,2,3} % girder, klystron or power supply is displayed
  215. switch handles.DisplayType
  216. case 1
  217. displayed = GIRDER{ielem} ;
  218. case 2
  219. displayed = KLYSTRON(ielem) ;
  220. case 3
  221. displayed = PS(ielem) ;
  222. end
  223. if (SelectLine == handles.Eptr)
  224. set(handles.listbox1,'Value',displayed.Element) ;
  225. end
  226. end
  227. end
  228. %==========================================================================
  229. function listbox2_CreateFcn(hObject, eventdata, handles)
  230. %
  231. % Function which executes on creation of the detailed display listbox
  232. %
  233. % Input arguments:
  234. % hObject handle to listbox1 (see GCBO)
  235. % eventdata reserved - to be defined in a future version of MATLAB
  236. % handles empty - handles not created until after all CreateFcns called
  237. if ispc && isequal(get(hObject,'BackgroundColor'), ...
  238. get(0,'defaultUicontrolBackgroundColor'))
  239. set(hObject,'BackgroundColor','white');
  240. end
  241. %==========================================================================
  242. function listbox3_Callback(hObject, eventdata, handles)
  243. %
  244. % Executes on change in the selction of the auxiliary data structure
  245. % (GIRDER, KLYSTRON, PS) display.
  246. %
  247. % Input arguments:
  248. % hObject handle to listbox3 (see GCBO)
  249. % eventdata reserved - to be defined in a future version of MATLAB
  250. % handles structure with handles and user data (see GUIDATA)
  251. if (strcmp(get(handles.figure1,'SelectionType'),'open')) ;
  252. eptr = get(handles.listbox3,'Value') ;
  253. dt = get(handles.text1,'String') ;
  254. switch dt
  255. case 'GIRDER'
  256. dtype = 1 ;
  257. case 'KLYSTRON'
  258. dtype = 2 ;
  259. case 'PS'
  260. dtype = 3 ;
  261. case 'INSTR'
  262. dtype = 4 ;
  263. end
  264. DisplayElement(handles,eptr,dtype) ;
  265. end
  266. %==========================================================================
  267. function listbox3_CreateFcn(hObject, eventdata, handles)
  268. %
  269. % Function which executes on creation of the auxiliary listbox
  270. %
  271. % Input arguments:
  272. % hObject handle to listbox1 (see GCBO)
  273. % eventdata reserved - to be defined in a future version of MATLAB
  274. % handles empty - handles not created until after all CreateFcns called
  275. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  276. set(hObject,'BackgroundColor','white');
  277. end
  278. %==========================================================================
  279. function NewSearchButton_Callback(hObject, eventdata, handles)
  280. %
  281. % Handles the response to pressing the "New Search" button.
  282. %
  283. % Input arguments:
  284. % hObject handle to NewSearchButton (see GCBO)
  285. % eventdata reserved - to be defined in a future version of MATLAB
  286. % handles structure with handles and user data (see GUIDATA)
  287. % the response is completely handled in exterior code, but we tell it
  288. % whether to do a new or repeat search with the 2nd argument...
  289. DoBeamlineSearch(handles,1) ;
  290. %==========================================================================
  291. function RepeatSearchButton_Callback(hObject, eventdata, handles)
  292. %
  293. % Handles the response to pressing the "Repeat Search" button.
  294. %
  295. % Input arguments:
  296. % hObject handle to NewSearchButton (see GCBO)
  297. % eventdata reserved - to be defined in a future version of MATLAB
  298. % handles structure with handles and user data (see GUIDATA)
  299. % the response is completely handled in exterior code, but we tell it
  300. % whether to do a new or repeat search with the 2nd argument...
  301. DoBeamlineSearch(handles,0) ;
  302. %==========================================================================
  303. function RefreshBeamline_Callback(hObject, eventdata, handles)
  304. %
  305. % Executes in response to the "Refresh" button-push.
  306. %
  307. % Input arguments:
  308. % hObject handle to RefreshBeamline (see GCBO)
  309. % eventdata reserved - to be defined in a future version of MATLAB
  310. % handles structure with handles and user data (see GUIDATA)
  311. status = GetBeamline(handles) ;
  312. handles = guidata(hObject) ;
  313. handles.output = status ;
  314. DisplayElement(handles,handles.DisplayedElement,...
  315. handles.DisplayType) ;
  316. %==========================================================================
  317. function Girder_Callback(hObject, eventdata, handles)
  318. %
  319. % Executes in response to the "Girder" button push.
  320. %
  321. % Input arguments:
  322. % hObject handle to Girder (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. AuxDisplay(handles,1) ;
  326. %==========================================================================
  327. function Klystron_Callback(hObject, eventdata, handles)
  328. %
  329. % Executes in response to the "Klystron" button push.
  330. %
  331. % Input arguments:
  332. % hObject handle to Girder (see GCBO)
  333. % eventdata reserved - to be defined in a future version of MATLAB
  334. % handles structure with handles and user data (see GUIDATA)
  335. AuxDisplay(handles,2) ;
  336. %==========================================================================
  337. function PS_Callback(hObject, eventdata, handles)
  338. %
  339. % Executes in response to the "Power Supply" button push.
  340. %
  341. % Input arguments:
  342. % hObject handle to Girder (see GCBO)
  343. % eventdata reserved - to be defined in a future version of MATLAB
  344. % handles structure with handles and user data (see GUIDATA)
  345. AuxDisplay(handles,3) ;
  346. %==========================================================================
  347. %==========================================================================
  348. %==========================================================================
  349. %==========================================================================
  350. %==========================================================================
  351. % The functions below provide more of the logical "guts" of the Beamline
  352. % Viewer.
  353. %==========================================================================
  354. function status = GetBeamline(handles)
  355. %
  356. % fills up the data structures needed to display the information in the
  357. % Beamline view list box (on the left of the display)
  358. global BEAMLINE KLYSTRON PS GIRDER
  359. % construct the string version of each name in BEAMLINE, along with its
  360. % element class and its index
  361. if (isempty(BEAMLINE))
  362. status = 0 ;
  363. return ;
  364. elseif (~iscell(BEAMLINE))
  365. status = -1 ;
  366. return ;
  367. else
  368. status = 1 ;
  369. end
  370. eindex = 1:length(BEAMLINE) ;
  371. elem_shorthand = cell(length(BEAMLINE),1) ;
  372. svec = zeros(length(BEAMLINE),1) ;
  373. classvec = elem_shorthand ;
  374. namevec = elem_shorthand ;
  375. smax = 0 ;
  376. for count = eindex
  377. if ( (~isfield(BEAMLINE{count},'S')) || ...
  378. (~isfield(BEAMLINE{count},'Class')) || ...
  379. (~isfield(BEAMLINE{count},'Name')) )
  380. status = -1 ;
  381. return ;
  382. end
  383. svec(count) = BEAMLINE{count}.S ;
  384. if (abs(BEAMLINE{count}.S) > smax)
  385. smax = abs(BEAMLINE{count}.S) ;
  386. end
  387. end
  388. NIndex = floor(log(max(eindex))/log(10))+1 ;
  389. NLeftDigit = floor(log(smax)/log(10)) ;
  390. NDigit = NLeftDigit + 6 ;
  391. Format = ['%',num2str(NDigit,'%d'),'.4f'] ;
  392. for count = eindex
  393. indx = num2str(count,'%d') ;
  394. lindx = length(indx) ;
  395. if (lindx<NIndex)
  396. indx(lindx+1:NIndex) = ' ' ;
  397. end
  398. ist = num2str(BEAMLINE{count}.S,Format) ;
  399. lst = length(ist) ;
  400. spos = [] ;
  401. if (lst < NDigit)
  402. spos(1:(NDigit-lst)) = ' ' ;
  403. end
  404. lcl = length(BEAMLINE{count}.Class) ;
  405. classvec{count} = BEAMLINE{count}.Class ;
  406. cstr = [] ;
  407. if (lcl < 8)
  408. cstr(1:8-lcl) = ' ' ;
  409. end
  410. cstr = [cstr,BEAMLINE{count}.Class] ;
  411. spos = [spos,ist] ;
  412. namevec{count} = BEAMLINE{count}.Name ;
  413. eshort = [indx,' ',spos,' ', ...
  414. cstr,' ',BEAMLINE{count}.Name] ;
  415. elem_shorthand{count} = eshort ;
  416. end
  417. handles.elements = elem_shorthand ;
  418. handles.class = classvec ;
  419. handles.name = namevec ;
  420. handles.spos = svec ;
  421. handles.index = eindex ;
  422. % get the number of girders, klystrons, power supplies and store them
  423. handles.ngirder = length(GIRDER) ;
  424. handles.nklys = length(KLYSTRON) ;
  425. handles.nps = length(PS) ;
  426. guidata(handles.figure1,handles) ;
  427. set(handles.listbox1,'String',handles.elements,...
  428. 'Value',1)
  429. % and that's it
  430. %==========================================================================
  431. function DoBeamlineSearch(handles,NewSearch)
  432. % function which does all the work of performing searches, managing the
  433. % search dialog box and its associated error dialog boxes, and storing data
  434. % from one call to the next when needed.
  435. persistent SearchClass SearchName SearchMinS SearchMaxS SearchDirection
  436. persistent SearchCount
  437. % is this the first call? if so, initialize
  438. if (isempty(SearchDirection))
  439. SearchClass = [] ;
  440. SearchName = [] ;
  441. SearchMinS = -Inf ;
  442. SearchMaxS = Inf ;
  443. SearchDirection = 1 ;
  444. SearchCount = 1 ;
  445. end
  446. % first step: if this is a new search, bring up the dialog box which
  447. % gets the user's desired search parameters
  448. if (NewSearch)
  449. if (SearchMinS == -Inf)
  450. MinS = [] ;
  451. else
  452. MinS = SearchMinS ;
  453. end
  454. if (SearchMaxS == Inf)
  455. MaxS = [] ;
  456. else
  457. MaxS = SearchMaxS ;
  458. end
  459. GoodReturn = 0 ;
  460. while (GoodReturn ~= 1)
  461. [a,b,c,d,e,f,g] = BeamlineSearch(SearchClass,SearchName,...
  462. num2str(MinS),num2str(MaxS),...
  463. SearchDirection,SearchCount) ;
  464. if (a==0)
  465. return ;
  466. end
  467. % since it turns out that there are a couple of ways that an empty string
  468. % can be empty, make sure that it's the right kind of empty now
  469. if (isempty(d))
  470. d = [] ;
  471. end
  472. if (isempty(e))
  473. e = [] ;
  474. end
  475. SearchClass = d ; SearchName = e ; SearchDirection = f ;
  476. SearchCount = g ;
  477. if (isempty(b))
  478. b = -Inf ;
  479. else
  480. b = str2double(b) ;
  481. end
  482. if (isempty(c))
  483. c = Inf ;
  484. else
  485. c = str2double(c) ;
  486. end
  487. if ( (isnan(b)) || (isnan(c)) )
  488. beep
  489. uiwait(msgbox('Invalid S limits specified',...
  490. 'Beamline Search Error','error','modal')) ;
  491. else
  492. GoodReturn = 1 ;
  493. SearchMinS = b ;
  494. SearchMaxS = c ;
  495. end
  496. end
  497. end
  498. % now we have all of the parameters, it is time to do the search! Start by
  499. % getting the current location of the highlighted element
  500. eptr = get(handles.listbox1,'Value') ;
  501. if (SearchDirection == 1)
  502. eptr = min(eptr) ;
  503. else
  504. eptr = max(eptr) ;
  505. end
  506. found = 0 ; found_index = [] ;
  507. while ( (found < SearchCount) && ...
  508. (eptr+SearchDirection > 1) && ...
  509. (eptr+SearchDirection < length(handles.index)) )
  510. eptr = eptr + SearchDirection ;
  511. % apply the screens which are selected by the user; since the S position
  512. % screen uses +/- infinity, it's always active
  513. if ( (handles.spos(eptr) < SearchMinS) || ...
  514. (handles.spos(eptr) > SearchMaxS) )
  515. continue ;
  516. end
  517. if ( (~isempty(SearchClass)) && ...
  518. (~strcmpi(SearchClass,handles.class{eptr})) )
  519. continue ;
  520. end
  521. if ( (~isempty(SearchName)) && ...
  522. (~strcmpi(SearchName,handles.name{eptr})) )
  523. continue ;
  524. end
  525. % if we got this far, then we found the next match
  526. found = found+1 ;
  527. found_index = [found_index eptr] ;
  528. end
  529. % did we find something? if so, move the focus to the found item
  530. if (found>0)
  531. set(handles.listbox1,'Value',found_index) ;
  532. else
  533. uiwait(msgbox('No matches found for the selected search parameters',...
  534. 'Beamline Search: No Matches','warn','modal')) ;
  535. end
  536. %==========================================================================
  537. function DisplayElement(handles,eptr,idisp)
  538. % gets the data for the detailed view list box and puts it into the
  539. % relevant data structure for displaying. The idisp argument tells it
  540. % whether to display a BEAMLINE, GIRDER, KLYSTRON or PS structure.
  541. global BEAMLINE GIRDER KLYSTRON PS INSTR FL;
  542. % clear the display on initialization
  543. if (eptr == 0)
  544. set(handles.listbox2,'String',' ') ;
  545. set(handles.text3,'String',' ') ;
  546. handles.DisplayedElement = 0 ;
  547. guidata(handles.figure1,handles) ;
  548. return ;
  549. end
  550. % if this is a for-real call, we display the element's properties:
  551. disptext = [] ;
  552. switch idisp
  553. case 0
  554. if (eptr <= length(BEAMLINE))
  555. dispdat = BEAMLINE{eptr} ;
  556. disptext = ['BEAMLINE{',num2str(eptr,'%d'),'}'] ;
  557. else
  558. eptr = 0 ;
  559. end
  560. case 1
  561. if (eptr <= length(GIRDER))
  562. dispdat = GIRDER{eptr} ;
  563. disptext = ['GIRDER{',num2str(eptr,'%d'),'}'] ;
  564. else
  565. eptr = 0 ;
  566. end
  567. case 2
  568. if (eptr <= length(KLYSTRON))
  569. dispdat = KLYSTRON(eptr) ;
  570. disptext = ['KLYSTRON(',num2str(eptr,'%d'),')'] ;
  571. else
  572. eptr = 0 ;
  573. end
  574. case 3
  575. if (eptr <= length(PS))
  576. dispdat = PS(eptr) ;
  577. disptext = ['PS(',num2str(eptr,'%d'),')'] ;
  578. else
  579. eptr = 0 ;
  580. end
  581. case 4
  582. if (eptr <= length(INSTR))
  583. dispdat = INSTR{eptr} ;
  584. disptext = ['INSTR{',num2str(eptr,'%d'),'}'] ;
  585. else
  586. eptr = 0 ;
  587. end
  588. end
  589. if (eptr ~= 0)
  590. [bdata,e,g,k,p,b,s,in] = GetStringsFromStructureFields(dispdat,0) ;
  591. else
  592. bdata = {' '} ;
  593. e = 0 ; g = 0 ; k = 0 ; p = 0 ; b = 0 ; s = 0 ;
  594. end
  595. % Floodland data
  596. if ~isempty(FL)
  597. bdata{end+1}=' ';
  598. bdata{end+1}='Access permission: 0';
  599. if isfield(handles,'UserData') && ~isempty(handles.UserData) && iscell(handles.UserData) && ~isempty(handles.UserData{1})
  600. for ireq=1:length(handles.UserData{1})
  601. if idisp==handles.UserData{1}(ireq).reqType && ismember(eptr,handles.UserData{1}(ireq).req)
  602. bdata{end}=['Access permission: ',handles.UserData{1}(ireq).reqResp];
  603. end % if access granted
  604. end % for ireq
  605. end % if access request made
  606. end % ~empty FL
  607. set(handles.listbox2,'String',bdata,...
  608. 'Value',1)
  609. set(handles.text3,'String',disptext) ;
  610. handles.DisplayedElement = eptr ;
  611. handles.DisplayType = idisp ;
  612. handles.Eptr = e ;
  613. handles.Gptr = g ;
  614. handles.Kptr = k ;
  615. handles.Pptr = p ;
  616. handles.Bptr = b ;
  617. handles.Sptr = s ;
  618. handles.Iptr = in ;
  619. guidata(handles.figure1,handles) ;
  620. %==========================================================================
  621. function [bdata,varargout] = GetStringsFromStructureFields(structure,indent)
  622. % go to a data structure, get the field names and field values, and return
  623. % them as a cell array. If a field has subfields, process it later than
  624. % the fields which have simple numeric values. While we're at it, if the
  625. % data structure has Element, Girder, Klystron, PS, Block, or Slices fields
  626. % return their positions in the display for later use by the listbox
  627. % managers.
  628. indstep = 4 ;
  629. e = 0 ; g = 0 ; k = 0 ; p = 0 ; b = 0 ; s = 0 ; in = 0 ;
  630. % get the field names from the structure
  631. fn = fieldnames(structure) ;
  632. fnmax = 0 ;
  633. for count = 1:length(fn)
  634. % end
  635. fnmax = max([fnmax length(fn{count})]) ;
  636. end
  637. bdata = cell(1) ;
  638. % get the data values and build an overall string...
  639. linecount = 0 ;
  640. for count = 1:length(fn)
  641. f = getfield(structure,fn{count}) ; %#ok<GFLD>
  642. if (isstruct(f))
  643. continue ;
  644. end
  645. linecount = linecount + 1 ;
  646. switch fn{count}
  647. case 'Element'
  648. e = linecount ;
  649. case 'Girder'
  650. g = linecount ;
  651. case 'Klystron'
  652. k = linecount ;
  653. case 'PS'
  654. p = linecount ;
  655. case 'Block'
  656. b = linecount ;
  657. case 'Slices'
  658. s = linecount ;
  659. case 'Instrument'
  660. in = linecount ;
  661. end
  662. fstring = [] ;
  663. fstring(1:fnmax-length(fn{count})+indent) = ' ' ;
  664. fstring = [fstring,fn{count},': '] ;
  665. if (isnumeric(f))
  666. fstring = [fstring,num2str(f)] ;
  667. elseif (ischar(f))
  668. fstring = [fstring,f] ;
  669. elseif (iscell(f))
  670. fstring = [fstring,'{cell array}'] ;
  671. end
  672. bdata{linecount} = fstring ;
  673. end
  674. % now do the nested data structures via a recursive call to this very data
  675. % structure
  676. for count = 1:length(fn)
  677. f = getfield(structure,fn{count}) ; %#ok<GFLD>
  678. if (~isstruct(f))
  679. continue ;
  680. end
  681. linecount = linecount+2 ;
  682. fstring = [] ;
  683. fstring(1:fnmax-length(fn{count})+indent) = ' ' ;
  684. fstring = [fstring,fn{count},': '] ;
  685. bdata{linecount} = fstring ;
  686. breturn = GetStringsFromStructureFields(f,indent+indstep) ;
  687. for count2 = 1:length(breturn)
  688. linecount = linecount + 1 ;
  689. bdata{linecount} = breturn{count2} ;
  690. end
  691. end
  692. if (nargout > 1)
  693. varargout{1} = e ;
  694. varargout{2} = g ;
  695. varargout{3} = k ;
  696. varargout{4} = p ;
  697. varargout{5} = b ;
  698. varargout{6} = s ;
  699. varargout{7} = in ;
  700. end
  701. %==========================================================================
  702. function AuxDisplay(handles, idisp)
  703. % fill the center list box, which shows GIRDER, KLYSTRON, or PS index
  704. % numbers.
  705. global GIRDER KLYSTRON PS INSTR
  706. handles.AuxDisp = idisp ;
  707. switch idisp
  708. case 1 % GIRDER
  709. dtype = 'GIRDER' ;
  710. ndisp = length(GIRDER) ;
  711. case 2 % KLYSTRON
  712. dtype = 'KLYSTRON' ;
  713. ndisp = length(KLYSTRON) ;
  714. case 3 % PS
  715. dtype = 'PS' ;
  716. ndisp = length(PS) ;
  717. case 4 % INSTR
  718. dtype = 'INSTR' ;
  719. ndisp = length(INSTR) ;
  720. case 0 % no selection
  721. dtype = [] ;
  722. ndisp = 0 ;
  723. end
  724. disp = cell(ndisp,1) ;
  725. if (ndisp > 0)
  726. for count = 1:ndisp
  727. disp{count} = num2str(count,'%d') ;
  728. end
  729. end
  730. guidata(handles.figure1,handles) ;
  731. set(handles.listbox3,'String',disp,...
  732. 'Value',min([ndisp 1])) ;
  733. set(handles.text1,'String',dtype) ;
  734. % --- Executes on button press in pushbutton7.
  735. function pushbutton7_Callback(hObject, eventdata, handles)
  736. % hObject handle to pushbutton7 (see GCBO)
  737. % eventdata reserved - to be defined in a future version of MATLAB
  738. % handles structure with handles and user data (see GUIDATA)
  739. % INSTRUMENT data request
  740. AuxDisplay(handles,4) ;
  741. % --- Executes on button press in pushbutton8.
  742. function pushbutton8_Callback(hObject, eventdata, handles)
  743. % hObject handle to pushbutton8 (see GCBO)
  744. % eventdata reserved - to be defined in a future version of MATLAB
  745. % handles structure with handles and user data (see GUIDATA)
  746. % Make access request
  747. reqInd=get(handles.listbox3,'Value');
  748. if ~isempty(reqInd)
  749. switch handles.AuxDisp
  750. case 1
  751. [stat reqID] = AccessRequest({reqInd [] []});
  752. case 3
  753. [stat reqID] = AccessRequest({[] reqInd []});
  754. otherwise
  755. msgbox('Nothing to request here');
  756. return
  757. end % switch handles.AuxDisp
  758. end % if any requests
  759. if stat{1}~=1
  760. errordlg(stat{2},'Access Request error'); return;
  761. end
  762. if ~reqID
  763. errordlg('Access Refused','Access Request');
  764. granted='0';
  765. else
  766. granted='1';
  767. end % if refused
  768. if ~isfield(handles,'UserData') || isempty(handles.UserData) || ~iscell(handles.UserData)
  769. handles.UserData{1}(1).reqResp = granted ;
  770. handles.UserData{1}(1).reqID = reqID;
  771. handles.UserData{1}(1).req = reqInd;
  772. handles.UserData{1}(1).reqType = handles.AuxDisp ;
  773. else
  774. handles.UserData{1}(end+1).reqResp = granted ;
  775. handles.UserData{1}(end).reqID = reqID;
  776. handles.UserData{1}(end).req = reqInd;
  777. handles.UserData{1}(end).reqType = handles.AuxDisp ;
  778. end % if request data empty
  779. guidata(handles.figure1,handles) ;
  780. listbox2_Callback(handles.listbox2, 1, handles)
  781. % --- Executes on button press in pushbutton9.
  782. function pushbutton9_Callback(hObject, eventdata, handles)
  783. % hObject handle to pushbutton9 (see GCBO)
  784. % eventdata reserved - to be defined in a future version of MATLAB
  785. % handles structure with handles and user data (see GUIDATA)
  786. % Update status of access request(s) if made
  787. if isfield(handles,'UserData') && ~isempty(handles.UserData) && iscell(handles.UserData) && ~isempty(handles.UserData{1})
  788. for ireq=1:length(handles.UserData{1})
  789. [stat resp] = AccessRequest('status',handles.UserData{1}(ireq).reqID);
  790. handles.UserData{1}(ireq).reqResp = resp ;
  791. end % for ireq
  792. end % if request made
  793. guidata(handles.figure1,handles) ;
  794. listbox2_Callback(handles.listbox2, 1, handles)
  795. % --- Executes on button press in pushbutton10.
  796. function pushbutton10_Callback(hObject, eventdata, handles)
  797. % hObject handle to pushbutton10 (see GCBO)
  798. % eventdata reserved - to be defined in a future version of MATLAB
  799. % handles structure with handles and user data (see GUIDATA)
  800. guiCloseFn('BeamlineViewer',handles);
  801. % --- Executes when user attempts to close figure1.
  802. function figure1_CloseRequestFcn(hObject, eventdata, handles)
  803. % hObject handle to figure1 (see GCBO)
  804. % eventdata reserved - to be defined in a future version of MATLAB
  805. % handles structure with handles and user data (see GUIDATA)
  806. % Hint: delete(hObject) closes the figure
  807. try
  808. guiCloseFn('BeamlineViewer',handles);
  809. catch %#ok<CTCH>
  810. delete(hObject);
  811. end % try/catch
  812. % --- If Enable == 'on', executes on mouse press in 5 pixel border.
  813. % --- Otherwise, executes on mouse press in 5 pixel border or over listbox2.
  814. function listbox2_ButtonDownFcn(hObject, eventdata, handles)
  815. % hObject handle to listbox2 (see GCBO)
  816. % eventdata reserved - to be defined in a future version of MATLAB
  817. % handles structure with handles and user data (see GUIDATA)
  818. % --- Executes on slider movement.
  819. function slider1_Callback(hObject, eventdata, handles)
  820. % hObject handle to slider1 (see GCBO)
  821. % eventdata reserved - to be defined in a future version of MATLAB
  822. % handles structure with handles and user data (see GUIDATA)
  823. % Hints: get(hObject,'Value') returns position of slider
  824. % get(hObject,'Min') and get(hObject,'Max') to determine range of slider
  825. % --- Set zoom slider parameters
  826. set(handles.slider2,'Min',1);
  827. set(handles.slider2,'Max',max(min(get(handles.slider1,'Max')-round(get(handles.slider1,'Value')),round(get(handles.slider1,'Value'))-get(handles.slider1,'Min')),1));
  828. if round(get(handles.slider2,'Value')) < get(handles.slider2,'Min')
  829. set(handles.slider2,'Value',get(handles.slider2,'Min'));
  830. elseif round(get(handles.slider2,'Value')) > get(handles.slider2,'Max')
  831. set(handles.slider2,'Value',get(handles.slider2,'Max'));
  832. end % if past min/max
  833. if get(handles.slider1,'Value') == get(handles.slider1,'Min')
  834. set(handles.slider2,'Max',get(handles.slider2,'Max')+0.1);
  835. elseif get(handles.slider1,'Value') == get(handles.slider1,'Max')
  836. set(handles.slider2,'Min',get(handles.slider2,'Min')-0.1);
  837. end % if at min or max
  838. % redo plot
  839. plotFunc(handles);
  840. % --- Executes during object creation, after setting all properties.
  841. function slider1_CreateFcn(hObject, eventdata, handles)
  842. % hObject handle to slider1 (see GCBO)
  843. % eventdata reserved - to be defined in a future version of MATLAB
  844. % handles empty - handles not created until after all CreateFcns called
  845. % Hint: slider controls usually have a light gray background.
  846. if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  847. set(hObject,'BackgroundColor',[.9 .9 .9]);
  848. end
  849. % --- Executes on slider movement.
  850. function slider2_Callback(hObject, eventdata, handles)
  851. % hObject handle to slider2 (see GCBO)
  852. % eventdata reserved - to be defined in a future version of MATLAB
  853. % handles structure with handles and user data (see GUIDATA)
  854. % Hints: get(hObject,'Value') returns position of slider
  855. % get(hObject,'Min') and get(hObject,'Max') to determine range of slider
  856. % redo plot
  857. plotFunc(handles);
  858. % --- Executes during object creation, after setting all properties.
  859. function slider2_CreateFcn(hObject, eventdata, handles)
  860. % hObject handle to slider2 (see GCBO)
  861. % eventdata reserved - to be defined in a future version of MATLAB
  862. % handles empty - handles not created until after all CreateFcns called
  863. % Hint: slider controls usually have a light gray background.
  864. if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  865. set(hObject,'BackgroundColor',[.9 .9 .9]);
  866. end
  867. % --- Executes on selection change in popupmenu2.
  868. function popupmenu2_Callback(hObject, eventdata, handles)
  869. % hObject handle to popupmenu2 (see GCBO)
  870. % eventdata reserved - to be defined in a future version of MATLAB
  871. % handles structure with handles and user data (see GUIDATA)
  872. % Hints: contents = get(hObject,'String') returns popupmenu2 contents as cell array
  873. % contents{get(hObject,'Value')} returns selected item from popupmenu2
  874. % --- Executes during object creation, after setting all properties.
  875. function popupmenu2_CreateFcn(hObject, eventdata, handles)
  876. % hObject handle to popupmenu2 (see GCBO)
  877. % eventdata reserved - to be defined in a future version of MATLAB
  878. % handles empty - handles not created until after all CreateFcns called
  879. % Hint: popupmenu controls usually have a white background on Windows.
  880. % See ISPC and COMPUTER.
  881. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  882. set(hObject,'BackgroundColor','white');
  883. end
  884. % --- Executes on selection change in popupmenu3.
  885. function popupmenu3_Callback(hObject, eventdata, handles)
  886. % hObject handle to popupmenu3 (see GCBO)
  887. % eventdata reserved - to be defined in a future version of MATLAB
  888. % handles structure with handles and user data (see GUIDATA)
  889. % Hints: contents = get(hObject,'String') returns popupmenu3 contents as cell array
  890. % contents{get(hObject,'Value')} returns selected item from popupmenu3
  891. % --- Executes during object creation, after setting all properties.
  892. function popupmenu3_CreateFcn(hObject, eventdata, handles)
  893. % hObject handle to popupmenu3 (see GCBO)
  894. % eventdata reserved - to be defined in a future version of MATLAB
  895. % handles empty - handles not created until after all CreateFcns called
  896. % Hint: popupmenu controls usually have a white background on Windows.
  897. % See ISPC and COMPUTER.
  898. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  899. set(hObject,'BackgroundColor','white');
  900. end
  901. function plotFunc(handles,cmd,Initial_in,Beam_in)
  902. % Function to handle plotting of stuff in axis
  903. global BEAMLINE FL INSTR
  904. persistent Initial Beam
  905. if exist('Initial_in','var')
  906. Initial=Initial_in;
  907. end
  908. if exist('Beam_in','var')
  909. Beam=Beam_in;
  910. end
  911. if exist('cmd','var')
  912. if isequal(cmd,'init')
  913. secstr_in=get(handles.popupmenu3,'String');
  914. if ~iscell(secstr_in)
  915. secstr{1}=secstr_in;
  916. else
  917. secstr=secstr_in;
  918. end % if secstr cell
  919. switch lower(secstr{get(handles.popupmenu3,'Value')})
  920. case 'all'
  921. firstele=1; lastele=length(BEAMLINE);
  922. otherwise
  923. firstele=FL.Section.(secstr{get(handles.popupmenu3,'Value')}).inds(1);
  924. lastele=FL.Section.(secstr{get(handles.popupmenu3,'Value')}).inds(2);
  925. end % switch section
  926. set(handles.slider1,'Min',1);
  927. set(handles.slider1,'Max',lastele);
  928. set(handles.slider1,'Value',floor((lastele-firstele)/2));
  929. set(handles.slider2,'Min',1);
  930. set(handles.slider2,'Max',max(min(get(handles.slider1,'Max')-round(get(handles.slider1,'Value')),round(get(handles.slider1,'Value'))-get(handles.slider1,'Min')),1));
  931. set(handles.slider2,'Value',get(handles.slider2,'Max'));
  932. else
  933. error('unknown input to BeamlineViewer:plotFunc')
  934. end % if init
  935. end % if cmd given
  936. firstele=max(round(get(handles.slider1,'Value'))-round(get(handles.slider2,'Value')),get(handles.slider1,'Min'));
  937. lastele=min(round(get(handles.slider1,'Value'))+round(get(handles.slider2,'Value')),get(handles.slider1,'Max'));
  938. selval=round(get(handles.listbox4,'Value'));
  939. % ahan=get(handles.uipanel1,'Children');
  940. ahan=subplot(1,1,1,'Parent',handles.uipanel1);
  941. if length(selval)==1 && selval==1
  942. if BEAMLINE{firstele}.S==BEAMLINE{lastele}.S
  943. return % nothing to plot
  944. end % if first and last S the same
  945. axis(ahan(1),[BEAMLINE{firstele}.S BEAMLINE{lastele}.S 1 10]);
  946. AddMagnetPlot(firstele,lastele,handles.uipanel1,'replace');
  947. elseif lastele>firstele
  948. pnames_in=get(handles.listbox4,'String');
  949. if ~iscell(pnames_in)
  950. pnames{1}=pnames_in;
  951. else
  952. pnames=pnames_in;
  953. end % if pnames cell
  954. if sum(selval~=1)>1
  955. selval=[selval(end-1) selval(end)];
  956. else
  957. selval=selval(end);
  958. end % if multiple selects
  959. for isel=1:length(selval)
  960. if selval(isel)>=2 && selval(isel)<=9
  961. if (isempty(FL) || ~isfield(FL,'SimModel') || ~isfield(FL.SimModel,'Initial')) && isempty(Initial)
  962. errordlg('Must provide Lucretial Initial structure in BeamlinViewer call (Beamlineviewer(Initial)) or in FL.SimModel.Initial for twiss plots',...
  963. 'Twiss Plot Error')
  964. return
  965. end % if have the right stuff for Twiss plot
  966. if ~isempty(FL) && isfield(FL,'SimModel') && isfield(FL.SimModel,'Initial')
  967. Initial_this=FL.SimModel.Initial;
  968. else
  969. Initial_this=Initial;
  970. end % get Initial
  971. [stat, twiss] = GetTwiss(firstele,lastele,Initial_this.x.Twiss,Initial_this.y.Twiss) ;
  972. if stat{1}~=1; return; end
  973. xplot(isel,:)=twiss.S(2:end);
  974. yplot(isel,:)=twiss.(pnames{selval(isel)})(2:end);
  975. elseif selval(isel)>9
  976. if (isempty(INSTR) || ~isfield(INSTR{end},'Index') || INSTR{end}.Index<lastele) && isempty(Beam)
  977. errordlg('Must provide Lucretia Beam structure in BeamlineViewer call or Floodland global INSTR structure for bpm plot',...
  978. 'BPM plot error')
  979. return
  980. end % if right stuff for BPM plot
  981. if ~isempty(INSTR)
  982. xp=cellfun(@(x) BEAMLINE{x.Index}.S,INSTR);
  983. if selval(isel)==10
  984. yp=cellfun(@(x) x.Data(1),INSTR);
  985. elseif selval(isel)==11
  986. yp=cellfun(@(x) x.Data(2),INSTR);
  987. end % if x or y
  988. yplot(isel,:)=yp(cellfun(@(x) x.Index>=firstele&x.Index<=lastele,INSTR));
  989. xplot(isel,:)=xp(cellfun(@(x) x.Index>=firstele&x.Index<=lastele,INSTR));
  990. else
  991. [stat,beamout,instdata] = TrackThru( firstele, lastele, Beam, 1, 1, 0 );if stat{1}~=1; errordlg(stat{2:end},'Tracking error'); return; end;
  992. xplot(isel,:)=[instdata{1}.S];
  993. if selval(isel)==10
  994. yplot(isel,:)=[instdata{1}([instdata{1}.Index]>=firstele&[instdata{1}.Index]<=lastele).x];
  995. elseif selval(isel)==1
  996. yplot(isel,:)=[instdata{1}([instdata{1}.Index]>=firstele&[instdata{1}.Index]<=lastele).y];
  997. end % if x or y
  998. [xplot(isel,:) I]=sort(xplot(isel,:));
  999. yplot(isel,:)=yplot(isel,I);
  1000. end % if FL or not
  1001. end % if a twiss plot demand
  1002. end % for isel
  1003. if length(selval)==1
  1004. plot(ahan(1),xplot,yplot)
  1005. else
  1006. plotyy(ahan(1),xplot(1,:),yplot(1,:),xplot(2,:),yplot(2,:))
  1007. end % if 1 or 2 plots
  1008. % Addmagnet plot doesn't work properly when adding on top of another plot
  1009. % in uipanel because axes doesn't select new axes properly- need to fix
  1010. % somehow -- use subplot and addmagnet replace on top subplot?---
  1011. % ahan=subplot(2,1,1,'Parent',handles.uipanel1);
  1012. % AddMagnetPlot(firstele,lastele,handles.uipanel1);
  1013. end % if plotmenu
  1014. % --- Executes on selection change in listbox4.
  1015. function listbox4_Callback(hObject, eventdata, handles)
  1016. % hObject handle to listbox4 (see GCBO)
  1017. % eventdata reserved - to be defined in a future version of MATLAB
  1018. % handles structure with handles and user data (see GUIDATA)
  1019. % Hints: contents = get(hObject,'String') returns listbox4 contents as cell array
  1020. % contents{get(hObject,'Value')} returns selected item from listbox4
  1021. % --- Executes during object creation, after setting all properties.
  1022. function listbox4_CreateFcn(hObject, eventdata, handles)
  1023. % hObject handle to listbox4 (see GCBO)
  1024. % eventdata reserved - to be defined in a future version of MATLAB
  1025. % handles empty - handles not created until after all CreateFcns called
  1026. % Hint: listbox controls usually have a white background on Windows.
  1027. % See ISPC and COMPUTER.
  1028. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  1029. set(hObject,'BackgroundColor','white');
  1030. end
  1031. % --- If Enable == 'on', executes on mouse press in 5 pixel border.
  1032. % --- Otherwise, executes on mouse press in 5 pixel border or over listbox4.
  1033. function listbox4_ButtonDownFcn(hObject, eventdata, handles)
  1034. % hObject handle to listbox4 (see GCBO)
  1035. % eventdata reserved - to be defined in a future version of MATLAB
  1036. % handles structure with handles and user data (see GUIDATA)
  1037. % --- Executes on mouse press over axes background.
  1038. function axes1_ButtonDownFcn(hObject, eventdata, handles)
  1039. % hObject handle to axes1 (see GCBO)
  1040. % eventdata reserved - to be defined in a future version of MATLAB
  1041. % handles structure with handles and user data (see GUIDATA)
  1042. % --------------------------------------------------------------------
  1043. function uipanel1_ButtonDownFcn(hObject, eventdata, handles)
  1044. % hObject handle to uipanel1 (see GCBO)
  1045. % eventdata reserved - to be defined in a future version of MATLAB
  1046. % handles structure with handles and user data (see GUIDATA)
  1047. ele=get(hObject,'UserData');
  1048. if ~isempty(ele)
  1049. set(handles.slider1,'Value',ele);
  1050. slider1_Callback(handles.slider1,[],handles);
  1051. set(handles.listbox1,'Value',ele)
  1052. listbox1_Callback(handles.listbox1,2,handles);
  1053. end % if not empty ele
  1054. % --- Executes on button press in pushbutton11.
  1055. function pushbutton11_Callback(hObject, eventdata, handles)
  1056. % hObject handle to pushbutton11 (see GCBO)
  1057. % eventdata reserved - to be defined in a future version of MATLAB
  1058. % handles structure with handles and user data (see GUIDATA)
  1059. plotFunc(handles);