comparison m-toolbox/m/gui/gltpda/pan1main.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f0afece42f48
1 function pan1main(varargin)
2 % This is the function for the main panel of the GUI LTPDA, the package of
3 % data analysis functions developed for the LISA Pathfinder Mission / LISA
4 % Technology Package.
5 %
6 % $Id: pan1main.m,v 1.57 2010/08/02 18:30:20 ingo Exp $
7
8 global LTPDAinvar LTPDAoutvar currentsystem gl loop selBlocks
9
10 % Initialize the list of AOs:
11 InputObjList=''; % OutputObjList='';
12 UpdateListbox();
13 set(gcf,'NextPlot','new');
14
15 selBlocks = [];
16 scaleX = getappdata(0, 'ltpda_gui_scalefactor');
17 guiFontSize = round(8*scaleX);
18
19 alltimers = timerfindall;
20 stop(alltimers(2));
21 set(alltimers(2),'TimerFcn',@ContinuousCheck,'Period',.5);
22 start(alltimers(2));
23 set(gcf,'NextPlot','new')
24 set(gcf,'CloseRequestFcn',{@AskConfirm,'close'})
25
26 %%
27
28 currPanel = varargin{1};
29 if nargin>1, runSim = varargin{2}; else runSim = 0; end
30 panelDimens = get(currPanel, 'Position');
31 backColor = get(currPanel, 'BackgroundColor');
32
33 uicontrol('Parent',currPanel,'TooltipString','login/logout','Units','pixels','HorizontalAlignment','center','Position',[60 panelDimens(4)*0.925 40 20],'String','log','FontSize',guiFontSize,'Visible','on','Enable','on','Callback',@LogoutCallback,'Style','pushbutton');
34 uicontrol('Parent',currPanel,'BackgroundColor',backColor,'TooltipString','username','Units','pixels','HorizontalAlignment','left','Position',[110 panelDimens(4)*0.93 150 15],'String',getappdata(0,'ltpda_repo_user'),'FontSize',guiFontSize+1,'Style','text');
35 currsystem = bdroot;
36 if isempty(currsystem) || isempty(find_system(currsystem,'FindAll','on','Type','Annotation','Tag','ltpda model')), currsystem = 'None'; end
37 uicontrol('Parent',currPanel,'BackgroundColor',backColor,'HorizontalAlignment','left','Units','pixels','Position',[230 panelDimens(4)*0.93 300 15],'String',['Current system: ',currsystem],'FontSize',guiFontSize+1,'FontWeight','normal','Visible','on','Tag','currsystem','Style','text');
38
39
40 AnalysPanPos = [.005 .8 .990 .111];
41 hanalysisPanel = uipanel('Parent',currPanel,'Title',' Analyses Control ','BackgroundColor',backColor,'FontSize',guiFontSize-1,'Units','normalized','Position',AnalysPanPos);
42 nbuttons = 3;
43 buttonWidth = (AnalysPanPos(3)-.01*(nbuttons))/nbuttons;
44 buttonPos = [AnalysPanPos(1) .2 buttonWidth .6];
45 uicontrol('Parent',hanalysisPanel,'Units','pixels','Units','normalized','Position',buttonPos,'String','New model','TooltipString','Create a new LTPDA Simulink model','HorizontalAlignment','center','FontSize',guiFontSize,'Visible','on','Enable','on','Callback',@hNewButtonCallback,'Style','pushbutton');
46 buttonPos(1) = buttonPos(1)+buttonWidth+.0125;
47 uicontrol('Parent',hanalysisPanel,'Units','pixels','Units','normalized','Position',buttonPos,'String','Open model','TooltipString','Open an existing LTPDA Simulink model','HorizontalAlignment','center','FontSize',guiFontSize,'Visible','on','Enable','on','Callback',@hOpenCallback,'Style','pushbutton');
48 buttonPos(1) = buttonPos(1)+buttonWidth+.0125;
49 uicontrol('Parent',hanalysisPanel,'Units','pixels','Units','normalized','Position',buttonPos,'String','Save model','TooltipString','Save the currently selected LTPDA Simulink model','HorizontalAlignment','center','FontSize',guiFontSize,'Visible','on','Enable','on','Callback',@hSaveCallback,'Style','pushbutton');
50 clear AnalysPanPos nbuttons buttonWidth buttonPos
51
52
53 DataPanPos = [.005 .1633 .990 .615];
54 hDataPanel = uipanel('Parent',currPanel,'Title',' Data Control ','BackgroundColor',backColor,'FontSize',guiFontSize-1,'Units','normalized','Position',DataPanPos);
55 nbuttons = 3;
56 buttonWidth = (DataPanPos(3)-.01*(nbuttons))/nbuttons;
57 buttonPos = [DataPanPos(1) .9 buttonWidth .08];
58 uicontrol('Parent',hDataPanel,'Units','normalized','HorizontalAlignment','center','Position',buttonPos,'String','Clear all input','TooltipString','Clear from memory the entire list of input objects','FontSize',guiFontSize,'Visible','on','Enable','on','Callback',{@AskConfirm,'clear'},'Style','pushbutton');
59 buttonPos(1) = buttonPos(1)+buttonWidth+.0125;
60 % uicontrol('Parent',hDataPanel,'Units','normalized','HorizontalAlignment','center','Position',buttonPos,'String','Load','TooltipString','Load data from file','FontSize',guiFontSize,'Visible','on','Enable','on','Callback',@hLoadDataButtonCallback,'Style','pushbutton');
61 % buttonPos(1) = buttonPos(1)+buttonWidth+.0125;
62 % uicontrol('Parent',hDataPanel,'Units','normalized','HorizontalAlignment','center','Position',buttonPos,'String','Remove','TooltipString','Clear the selected object from memory','FontSize',guiFontSize,'Visible','on','Enable','on','Callback',@hRemoveButtonCallback,'Style','pushbutton');
63 % buttonPos(1) = buttonPos(1)+buttonWidth+.0125;
64 % uicontrol('Parent',hDataPanel,'Units','normalized','HorizontalAlignment','center','Position',buttonPos,'String','Create','FontSize',guiFontSize,'Visible','on','Enable','off','UserData',InputObjList,'Callback',@hExploreButtonCallback,'Style','pushbutton');
65 % buttonPos(1) = buttonPos(1)+buttonWidth+.0125;
66 % uicontrol('Parent',hDataPanel,'Units','normalized','HorizontalAlignment','center','Position',buttonPos,'String','Edit','FontSize',guiFontSize,'Visible','on','Enable','off','UserData',InputObjList,'Callback',@hExploreButtonCallback,'Style','pushbutton');
67 % buttonPos(1) = buttonPos(1)+buttonWidth+.0125;
68 uicontrol('Parent',hDataPanel,'Units','normalized','HorizontalAlignment','center','Position',buttonPos,'String','Report','TooltipString','Report','FontSize',guiFontSize,'Visible','on','Enable','on','Callback',@hReportButtonCallback,'Style','pushbutton');
69 buttonPos(1) = buttonPos(1)+buttonWidth+.0125;
70 hExploreButton = uicontrol('Parent',hDataPanel,'Units','normalized','HorizontalAlignment','center','Position',buttonPos,'String','Explore','TooltipString','Explore the selected objects with the LTPDA Explorer','FontSize',guiFontSize,'Visible','on','Enable','on','UserData',InputObjList,'Callback',@hExploreButtonCallback,'Style','pushbutton');
71 clear nbuttons buttonWidth buttonPos
72 nbuttons = 3;
73 buttonWidth = (DataPanPos(3)-.01*(nbuttons))/nbuttons;
74 buttonPos = [DataPanPos(1) .8 buttonWidth .08];
75 uicontrol('Parent',hDataPanel,'Units','normalized','HorizontalAlignment','center','Position',buttonPos,'String','Export to workspace','TooltipString','Export the selected objects from LTPDA to MATLAB workspace','FontSize',guiFontSize,'Visible','on','Enable','on','Callback',@hExportButtonCallback,'Style','pushbutton');
76 buttonPos(1) = buttonPos(1)+buttonWidth+.0125;
77 uicontrol('Parent',hDataPanel,'Units','normalized','HorizontalAlignment','center','Position',buttonPos,'String','Save workspace','TooltipString','Save the LTPDA Workspace as .MAT file','FontSize',guiFontSize,'Visible','on','Enable','on','Callback',@SaveWorkspaceCallback,'Style','pushbutton');
78 buttonPos(1) = buttonPos(1)+buttonWidth+.0125;
79 uicontrol('Parent',hDataPanel,'Units','normalized','HorizontalAlignment','center','Position',buttonPos,'String','Load workspace','TooltipString','Load a workspace from a .MAT file','FontSize',guiFontSize,'Visible','on','Enable','on','Callback',@LoadWorkspaceCallback,'Style','pushbutton');
80 clear nbuttons buttonWidth buttonPos
81
82
83 nlists = 2;
84 listWidth = (DataPanPos(3)-.01*(nlists))/nlists;
85 listPos = [.01 .03 listWidth .7];
86 InputObjList = uicontrol('Parent',hDataPanel,'BackgroundColor',[0.95,0.95,0.95],'HorizontalAlignment','center','Units','normalized','Position',listPos,'String',listInput,'Value',1,'Max',10,'Min',1,'FontSize',guiFontSize,'FontWeight','normal','Visible','on','Enable','on','Callback',@hListObjsCallback,'Tag','InputObjList','Style','listbox');
87 set(hExploreButton,'UserData',InputObjList);
88 listPos(1) = listPos(1)+listWidth+.01;
89 % Info panel:
90 uicontrol('Parent',hDataPanel,'BackgroundColor',[0.94,0.94,1],'Style','listbox','HorizontalAlignment', 'left','Fontsize', guiFontSize,'Units','pixels','Units','normalized','Position',listPos,'Tag','infoPanel');
91 hListObjsCallback(InputObjList,1);
92 clear DataPanPos nlists listWidth listPos
93
94
95 hExecutionPanel = uipanel('Parent',currPanel,'Title',' Execution control ','BackgroundColor',[1,1,1],'FontSize',guiFontSize-1,'Units','normalized','Position',[.0125 .0222 .975 .121]);
96 if isempty(getappdata(0,'maintainresults')), setappdata(0,'maintainresults',0); end
97 uicontrol('Parent',hExecutionPanel,'BackgroundColor',backColor,'HorizontalAlignment','left','Units','normalized','Position',[.03 .3 .3 .5],'Value',getappdata(0,'maintainresults'),'String',' Maintain all results','FontSize',guiFontSize+1,'TooltipString','Enable this if you want to maintain the results from all blocks at the end of the analysis calculation','ForeGroundColor','black','Visible','on','Enable','off','Callback','setappdata(0,''maintainresults'',get(gco,''Value''))','Style','checkbox','Tag','enableCheckbox');
98 GUIprefs = getappdata(0, 'GUIpreferences');
99 if ~isfield(GUIprefs,'CAD'), GUIprefs.CAD = 0; setappdata(0, 'GUIpreferences',GUIprefs); end
100 uicontrol('Parent',hExecutionPanel,'BackgroundColor',backColor,'HorizontalAlignment','left','Units','normalized','Position',[.3 .3 .3 .5],'Value',GUIprefs.CAD,'String',' Quick design mode','FontSize',guiFontSize+1,'TooltipString','To enable quick model drawing: each copied block will be replaced by an hollow block and automatically connected','ForeGroundColor','black','Visible','on','Enable','off','Callback','GUIprefs.Copied=0; GUIprefs.CAD=get(gco,''Value'');setappdata(0, ''GUIpreferences'',GUIprefs); if get(gco,''Value''), ltpdagui(''Redraw'',2); end;','Style','checkbox','Tag','enableCheckbox');
101 if ~isfield(GUIprefs,'Detach'), GUIprefs.Detach = 0; setappdata(0, 'GUIpreferences',GUIprefs); end
102 uicontrol('Parent',hExecutionPanel,'BackgroundColor',backColor,'HorizontalAlignment','left','Units','normalized','Position',[.6 .3 .3 .5],'Value',GUIprefs.Detach,'String',' Detach panel','FontSize',guiFontSize+1,'TooltipString','','ForeGroundColor','black','Visible','on','Enable','off','Callback','GUIprefs.Detach=get(gco,''Value'');setappdata(0, ''GUIpreferences'',GUIprefs);try close(findobj(''Tag'',''parampanelFigure'')); catch, end;','Style','checkbox','Tag','enableCheckbox');
103
104 if runSim == 1, StartExec(); end
105
106 %%
107
108 % ========================================================================
109 % ========================================================================
110 % ============================== FUNCTIONS ===============================
111 % ========================================================================
112 % ========================================================================
113
114 %%
115 %----------------------------------------------------------------------
116 function ContinuousCheck(varargin)
117 % This is the function to execute a continuous timer check
118
119 % Keep alive the first timer:
120 alltimers = timerfindall;
121 if strcmp(get(alltimers(1),'Running'),'off'), start(alltimers(1)); end
122
123 currsys = bdroot;
124 if ~isempty(currsys) && ~isempty(find_system(currsys,'FindAll','on','Type','Annotation','Tag','ltpda model'))
125 set(findobj('Tag', 'currsystem'), 'String', ['Current system: ',currsys])
126 set(findobj('Tag', 'enableCheckbox'), 'enable', 'on')
127 else
128 set(findobj('Tag', 'currsystem'), 'String', 'Current system: None')
129 set(findobj('Tag', 'enableCheckbox'), 'enable', 'off')
130 end
131
132 nestBlock = find_system(bdroot,'BlockType','SubSystem','Tag','nestedloops');
133 if ~isempty(nestBlock), set(findobj('String',' Enable nested loops'),'Value',1); else set(findobj('String',' Enable nested loops'),'Value',0); end
134
135 end
136 %----------------------------------------------------------------------
137
138 %%
139 %----------------------------------------------------------------------
140 function LogoutCallback(varargin)
141 % Callback function: run when the user click the "Logout" button
142 setappdata(0,'ltpda_repo_pass','');
143 userID = getappdata(0,'ltpda_repo_user');
144 if isempty(userID), userID = ''; end
145 [userID passwd] = utils.mysql.logindlg(userID,'');
146 setappdata(0,'ltpda_repo_user',userID)
147 setappdata(0,'ltpda_repo_pass',passwd)
148 ltpdagui('Redraw',1);
149 end
150 %----------------------------------------------------------------------
151
152 %----------------------------------------------------------------------
153 function AskConfirm(varargin)
154 % Whenever the user click the Reset Parameters button
155
156 if strcmp(varargin{3},'close'), set(gcf,'Visible','off'); end
157
158 % Ask for confirmation:
159 screenSize = get(0,'ScreenSize');
160 backColor = [1 1 1];
161 position = [(screenSize(3)-250)/2,(screenSize(4)-160)/2,250,160];
162 confirmFig = figure('Position',position,'Name','Please confirm','Tag','ConfirmReset','Resize','off','NumberTitle','off','Toolbar','none','Menubar','none');
163 % Text
164 uicontrol('Parent',confirmFig,'BackgroundColor',backColor,'HorizontalAlignment','center','Position',[0 position(4)-40 position(3) 20],'String','Are you sure?','FontName','Times New Roman','FontSize',13,'FontWeight','normal','Visible','on','Style','text');
165 % Button Yes
166 dimension = position;
167 logosize = [77 95];
168 dimension = [50 , dimension(4)-logosize(2)-50 , logosize];
169 yesbut = axes('Parent',confirmFig,'Units','pixels','Position',dimension,'Tag','Yes');
170 image(imread('buttonyes2.jpg'),'Parent',yesbut,'ButtonDownFcn','set(findobj(''Tag'',''ConfirmReset''),''UserData'',0); uiresume;','Tag','YesButton');
171 axis(yesbut,'off');
172 % Button No
173 dimension = position;
174 logosize = [77 95];
175 dimension = [127 , dimension(4)-logosize(2)-50 , logosize];
176 nobut = axes('Parent',confirmFig,'Units','pixels','Position',dimension,'Tag','No');
177 image(imread('buttonno2.jpg'),'Parent',nobut,'ButtonDownFcn','set(findobj(''Tag'',''ConfirmReset''),''UserData'',1); uiresume;','Tag','NoButton');
178 axis(nobut,'off');
179
180 uiwait;
181
182 if get(confirmFig,'UserData'), delete(confirmFig); set(findobj('Tag','LTPDAGUI'),'Visible','on'); return; end
183
184 if strcmp(varargin{3},'close')
185 delete(confirmFig);
186 disp('Closing LTPDA GUI...');
187 delete(timerfindall);
188 clear global LTPDAinvar LTPDAoutvar;
189 setappdata(0,'ltpda_repo_user',''); setappdata(0,'ltpda_repo_pass','');
190 closereq
191 elseif strcmp(varargin{3},'clear')
192 delete(confirmFig);
193 LTPDAinvar={};
194 set(InputObjList,'Value',1)
195 set(findobj('Tag', 'infoPanel'), 'String', '')
196 set_param(find_system(bdroot,'FindAll','on','Type','Annotation','Tag','ltpda model'),'UserData','');
197 UpdateListbox();
198 end
199
200 end
201 %----------------------------------------------------------------------
202
203 %%
204 % %----------------------------------------------------------------------
205 % function hLoadDataButtonCallback(varargin)
206 % % Callback function: run when the user click the "Add data" button
207 %
208 % filenames = uipickfiles('REFilter','.txt');
209 % if ~isempty(filenames) && ~isnumeric(filenames(1,1))
210 % y = size(filenames,2);
211 % for j=1:y
212 % ext = filenames{j}(end-2:end);
213 % if strcmpi(ext,'mat')
214 % varlist = whos('-file',filenames{j});
215 % for k=1:numel(varlist)
216 % newObj = load(filenames{j},varlist(k).name); %#ok<NASGU>
217 % newObj = eval(['newObj.',varlist(k).name]);
218 % if isa(newObj,'ltpda_uo')
219 % LTPDAinvar = [LTPDAinvar; {newObj,1,'From file'} ];
220 % disp(' + 1 Obj added to the global variable LTPDAinvar')
221 % end
222 % end
223 % elseif strcmpi(ext,'xml')
224 % newObj = utils.xml.xmlread(xmlread(filenames{j}));
225 % if isa(newObj,'ltpda_uo')
226 % LTPDAinvar = [LTPDAinvar; {newObj,1,'From file'} ];
227 % disp(sprintf(' + 1 %s added to the global variable LTPDAinvar',class(newObj)))
228 % end
229 % else
230 % try
231 % newObj = {ao(filenames{j}),1,'From file'};
232 % LTPDAinvar = [LTPDAinvar; {newObj,1,'From file'} ];
233 % disp(' + 1 AO added to the global variable LTPDAinvar')
234 % catch
235 % disp([' *** Impossible to load file ',filenames{j}])
236 % end
237 % end
238 % end
239 % UpdateListbox();
240 % end
241 %
242 % end
243 % %----------------------------------------------------------------------
244 %
245 % %----------------------------------------------------------------------
246 % function hRemoveButtonCallback(varargin)
247 % % Callback function: run when the user click the "Remove data" button
248 %
249 % index_selected = get(InputObjList,'Value');
250 % listObjs = get(InputObjList,'String');
251 % if ~strcmp(listObjs,'The memory is empty')
252 % for i=1:numel(index_selected)
253 % objSelect = str2double(strtok(listObjs{index_selected(i),1},'.'));
254 % LTPDAinvar{objSelect,1} = [];
255 % end
256 % UpdateListbox();
257 % end
258 % set(findobj('Tag', 'infoPanel'), 'String', '')
259 %
260 % end
261 % %----------------------------------------------------------------------
262
263 %----------------------------------------------------------------------
264 function hExportButtonCallback(varargin)
265 % Callback function: run when the user click the "Export data" button
266
267 currSelObjs = get(InputObjList,'Value');
268 listObjs = get(InputObjList,'String');
269 if ~strcmp(listObjs,'The memory is empty')
270 selectedObjs = {};
271 for i=1:numel(currSelObjs)
272 objSelect = str2double(strtok(listObjs{currSelObjs(i),1},'.'));
273 selectedObjs = [selectedObjs,LTPDAinvar(objSelect,1)];
274 end
275 if ~isempty(selectedObjs)
276 for i=1:numel(selectedObjs)
277 objName = [class(selectedObjs{i}),'_',selectedObjs{i}.name];
278 objName = genvarname(objName,evalin('base','who'));
279 assignin('base', objName, selectedObjs{i});
280 disp(['Saved to workspace with name ',objName])
281 end
282 end
283 end
284
285 end
286 %----------------------------------------------------------------------
287
288 %----------------------------------------------------------------------
289 function hExploreButtonCallback(varargin)
290 % Callback function: run when the user click the "Update list" button
291
292 currSelObjs = get(InputObjList,'Value');
293 listObjs = get(InputObjList,'String');
294 if ~strcmp(listObjs,'The memory is empty')
295 selectedObjs = {};
296 for i=1:numel(currSelObjs)
297 objSelect = str2double(strtok(listObjs{currSelObjs(i),1},'.'));
298 selectedObjs = [selectedObjs,LTPDAinvar(objSelect,1)];
299 end
300
301 if ~isempty(selectedObjs)
302 ltpda_explorer(selectedObjs);
303 else
304 ltpda_explorer(LTPDAinvar);
305 end
306
307 UpdateListbox();
308 end
309
310 end
311 %----------------------------------------------------------------------
312
313 %----------------------------------------------------------------------
314 function hReportButtonCallback(varargin)
315 % Callback function: run when the user click the "Update list" button
316
317 currSelObjs = get(InputObjList,'Value');
318 listObjs = get(InputObjList,'String');
319 if ~strcmp(listObjs,'The memory is empty')
320 selectedObjs = {};
321 for i=1:numel(currSelObjs)
322 objSelect = str2double(strtok(listObjs{currSelObjs(i),1},'.'));
323 selectedObjs = [selectedObjs,LTPDAinvar(objSelect,1)];
324 end
325
326 if ~isempty(selectedObjs)
327 report(selectedObjs,'dir',[cd,'\Reports']);
328 else
329 ltpda_explorer(LTPDAinvar);
330 end
331
332 UpdateListbox();
333 end
334
335 end
336 %----------------------------------------------------------------------
337
338 %----------------------------------------------------------------------
339 function SaveWorkspaceCallback(varargin)
340 % Callback function: run when the user click the "Save all"
341 % button
342
343 try
344 [FileName,PathName] = uiputfile('*.mat','Save Workspace As');
345 if ~isa(FileName,'double'), save(strcat(PathName,FileName),'LTPDAinvar','LTPDAoutvar'); disp('Workspace saved'); end
346 catch
347 end
348 end
349 %----------------------------------------------------------------------
350
351 %----------------------------------------------------------------------
352 function LoadWorkspaceCallback(varargin)
353 % Callback function: run when the user click the "Load workspace"
354 % button
355
356 try
357 [FileName,PathName] = uigetfile('*.mat','Load Workspace');
358 temp = load(strcat(PathName,FileName),'LTPDAinvar');
359 LTPDAinvar = [LTPDAinvar ; temp.LTPDAinvar];
360 temp = load(strcat(PathName,FileName),'LTPDAoutvar');
361 LTPDAoutvar = [LTPDAoutvar ; temp.LTPDAoutvar];
362 disp('Workspace loaded')
363 clear temp
364 UpdateListbox()
365 catch
366 end
367 end
368 %----------------------------------------------------------------------
369
370 %%
371 %----------------------------------------------------------------------
372 function UpdateListbox(varargin)
373 % Updates the listboxes
374
375 %==================================
376 % Update the list of active AOs
377 xx = size(LTPDAinvar,1);
378 listInput=cell(xx,1);
379 if xx>0
380 for j=1:xx
381 listInput{j,1} = num2str(j);
382 [rows,columns] = size(LTPDAinvar{j,1});
383 if (rows>1 && columns==1) || (rows==1 && columns>1), listInput{j,1} = [listInput{j,1}, ' .(Vector ',num2str(rows),'x',num2str(columns),') '];
384 elseif rows>1 && columns>1, listInput{j,1} = [listInput{j,1}, ' .(Matrix ',num2str(rows),'x',num2str(columns),') '];
385 end
386 if isempty(LTPDAinvar{j,1}), listInput{j,1} = [];
387 else
388 switch class(LTPDAinvar{j,1})
389 case 'ao'
390 anobject = LTPDAinvar{j,1};
391 aoname = anobject.name;
392 aocreated = char(anobject.created);
393 listInput{j,1} = [listInput{j,1}, ' . AO .' , aoname , '__' , aocreated];
394 case 'plist'
395 paramNumb = nparams(LTPDAinvar{j,1});
396 objcreated = char(LTPDAinvar{j,1}.created);
397 listInput{j,1}=[listInput{j,1}, ' . PLIST .',num2str(paramNumb),' params','__',objcreated];
398 case {'pzmodel','miir','mfir'}
399 objcreated = char(LTPDAinvar{j,1}.created);
400 listInput{j,1}=[listInput{j,1}, ' . ',upper(class(LTPDAinvar{j,1})),' .__',objcreated];
401 case 'double'
402 if numel(LTPDAinvar{j,1})==1, objclass = ' . Scalar .__ ';
403 elseif size(LTPDAinvar{j,1},1)==1 || size(LTPDAinvar{j,1},2)==1, objclass = ' . Vector .__ ';
404 else objclass = ' . Matrix .__ ';
405 end
406 listInput{j,1}=[listInput{j,1}, objclass, mat2str(LTPDAinvar{j,1})];
407 otherwise
408 listInput{j,1}=[listInput{j,1}, ' . ',upper(class(LTPDAinvar{j,1}))];
409 end
410 end
411 end
412 for j=xx:-1:1, if isempty(listInput{j,1}), listInput(j,:)=[]; end; end
413 else
414 listInput{1,1}='The workspace is empty';
415 end
416
417 InputObjList = findobj('Tag','InputObjList');
418 if ~isempty(InputObjList)
419 set(InputObjList,'Value',1)
420 set(InputObjList,'String',listInput)
421 end
422
423 end
424 %----------------------------------------------------------------------
425
426 %----------------------------------------------------------------------
427 function hListObjsCallback(hObject, varargin)
428 % This callback is called whenever the user double click upon one of
429 % the AOs in use.
430
431 if ~isempty(varargin{1}) && varargin{1}==1 && size(LTPDAinvar,1)>0
432 val = get(hObject, 'Value');
433 if length(val) == 1
434 objLines = get(hObject, 'String');
435 selVal = str2double(deblank(strtok(objLines{val})));
436 if isempty(objLines) || isempty(LTPDAinvar{selVal ,1}) || (isnumeric(LTPDAinvar{selVal ,1}) && numel(LTPDAinvar{selVal ,1})>1)
437 objtxt = '';
438 else
439 objtxt = display(LTPDAinvar{selVal,1});
440 end
441 else
442 objtxt = '';
443 end
444 set(findobj('Tag', 'infoPanel'), 'String', objtxt)
445 elseif size(LTPDAinvar,1)>0
446 if strcmp(get(gcf,'SelectionType'),'normal')
447 val = get(hObject, 'Value');
448 if length(val) == 1
449 objLines = get(hObject, 'String');
450 objnumb = str2double(deblank(strtok(objLines{val})));
451 try
452 objtxt = display(LTPDAinvar{objnumb});
453 catch
454 if isa(LTPDAinvar{objnumb},'double') || isa(LTPDAinvar{objnumb},'logical'), objtxt = mat2str(LTPDAinvar{objnumb});
455 elseif isa(LTPDAinvar{objnumb},'char'), objtxt = LTPDAinvar{objnumb,1};
456 else objtxt = class(LTPDAinvar{objnumb});
457 end
458 end
459 if isempty(LTPDAinvar{objnumb,1}), objtxt=''; end
460 else
461 objtxt = '';
462 end
463 set(findobj('Tag', 'infoPanel'), 'String', objtxt)
464 end
465
466 if strcmp(get(gcf,'SelectionType'),'open') && ~isempty(get(hObject, 'String')) && ~isempty(find_system(bdroot,'FindAll','on','Type','Annotation','Tag','ltpda model'))
467 val = get(hObject, 'Value');
468 objLines = get(hObject, 'String');
469 number = deblank(strtok(objLines{val}));
470 if isempty(LTPDAinvar{str2double(number),1}), return; end
471 set_param(utils.prog.gcbsh,'Selected','off');
472 newBlkHandle=add_block('ltpda_library/Input/Object from list', strcat(bdroot,'/AO1'),'MakeNameUnique', 'on');
473 children=get_param(newBlkHandle,'Blocks');
474 inputblock=strcat(get(newBlkHandle,'Path'),'/',get(newBlkHandle,'Name'),'/',children{1});
475 set_param(inputblock,'Value',number );
476 % Set the MaskDisplay = n� of input:
477 set_param(newBlkHandle,'LinkStatus','inactive');
478 set_param(newBlkHandle,'MaskDisplay',sprintf('disp(''%s'')',num2str(number)));
479 % Modify the block annotation:
480 objName = LTPDAinvar{str2double(number),1}.name;
481 if numel(objName)>3 && strcmpi(objName,'none'), objName = class(LTPDAinvar{str2double(number),1}); end
482 if numel(objName)>20, objName = ['...',LTPDAinvar{str2double(number),1}.name(end-20:end)]; end
483 set_param(newBlkHandle,'AttributesFormatString',[number,': ',objName]);
484 set_param(newBlkHandle,'Selected','on');
485
486 end
487 end
488
489 end
490 %----------------------------------------------------------------------
491
492 %%
493 %----------------------------------------------------------------------
494 function hNewButtonCallback(varargin)
495 % Callback function: run when the user click the "New model" button.
496 % It starts also the timer associated to the continuous selection check
497 % (this must be changed in order to allow multiple system execution).
498
499 hour = datestr(now,13); % HH:MM:SS
500 hour(3:4) = hour(4:5);hour(5:6)=hour(7:8);
501 currentsystem = strcat(genvarname(strrep(getappdata(0,'ltpda_repo_user'),'.','_')),'_',datestr(now,7),datestr(now,5),datestr(now,11),'_',hour(1:6));
502 if ~isempty(find_system('Name',currentsystem)), return; end
503 simulink
504 new_system(currentsystem)
505 open_system(currentsystem)
506
507 systemHandle = get_param(gcs,'Handle');
508 evalin('base','load ltpdaSimConfigSet.mat;');
509 ltpdaSimConfigSet = evalin('base','ltpdaSimConfigSet');
510 attachConfigSetCopy(systemHandle, ltpdaSimConfigSet);
511 setActiveConfigSet(systemHandle, 'LTPDA');
512 detachConfigSet(systemHandle, 'Configuration');
513 evalin('base','clear ltpdaSimConfigSet;');
514
515 set(systemHandle,'Location',[200 100 1100 600]);
516 set(systemHandle,'Toolbar','OFF');
517
518 caption = [gcs,'/1'];
519 libraryNote = add_block('built-in/Note',caption,'Position', [100 0 0 400]);
520 guiNote = add_block('built-in/Note',caption,'Position', [100 0 0 430]);
521 set_param(guiNote,'ClickFcn','ltpdagui(''Redraw'',2); figure(findobj(''Tag'',''LTPDAGUI''))')
522 set_param(libraryNote,'ClickFcn','simulink')
523 set_param(guiNote,'Text',' GUI ','FontSize',14,'HorizontalAlignment','center','BackgroundColor','[0.686275, 0.686275, 0.847059]','DropShadow','on')
524 set_param(libraryNote,'Text',' Library ','FontSize',14,'HorizontalAlignment','center','BackgroundColor','[0.870588, 0.870588, 0.937255]','DropShadow','on')
525
526 mainNote = add_block('built-in/Note',caption,'Position', [200 0 0 400],'UserData',1);
527 caption1 = [' Analysis designed by ',getappdata(0,'ltpda_repo_user')];
528 caption2 = ['created (UTC): ',char(time)];
529 caption3 = [' IP: ',char(getHostAddress(java.net.InetAddress.getLocalHost))];
530 caption4 = [' OS: ',computer];
531 caption5 = ['MATLAB ver: ',getappdata(0, 'matlab_version')];
532 caption6 = [' LTPDA ver: ',getappdata(0, 'ltpda_version')];
533 caption = strvcat(caption1,caption2,caption3,caption4,caption5,caption6); %#ok<VCAT>
534 set_param(mainNote, 'HorizontalAlignment','left','Text',caption,'Tag','ltpda model')
535 ltpdaClickFcn = 'load_system(''ltpda_library''); blk = add_block(''ltpda_library/Commonly Used Blocks/hollow'', strcat(bdroot,''/func1''),''MakeNameUnique'', ''on''); set(blk,''LinkStatus'',''inactive'',''MaskDisplay'',''disp(''''hollow'''')''); set(utils.prog.find_in_models(blk,''LookUnderMasks'',''all'',''BlockType'',''M-S-Function'',''FunctionName'',''ltpdasim''),''Tag'','''',''Name'',''hollow''); set(blk,''Selected'',''on'');set(find_system(bdroot,''FindAll'',''on'',''Type'',''Annotation'',''Tag'',''ltpda model''),''Selected'',''off''); ltpdagui(''callback'',1,''redraw'',2);';
536 set_param(mainNote,'ClickFcn',ltpdaClickFcn)
537
538 end
539 %----------------------------------------------------------------------
540
541 %----------------------------------------------------------------------
542 function hSaveCallback(varargin)
543 % This callback is called whenever the user click the 'Save' button to
544 % store the current model on disk.
545
546 if ~isempty(bdroot) && ~isempty(find_system(bdroot,'FindAll','on','Type','Annotation','Tag','ltpda model'))
547 inputBlockHandles = get_param(find_system(bdroot,'AncestorBlock','ltpda_library/Input/Object from list'),'handle');
548 for i=1:numel(inputBlockHandles)
549 children = get_param(inputBlockHandles{i},'Blocks');
550 inputblock = strcat(get(inputBlockHandles{i},'Path'),'/',get(inputBlockHandles{i},'Name'),'/',children{1});
551 currIndex(i) = str2double(get_param(inputblock,'Value'));
552 if currIndex(i)~=0
553 objcommand = string(LTPDAinvar{currIndex(i)});
554 set_param(inputBlockHandles{i},'Description',objcommand);
555 end
556 end
557
558 oldName = bdroot;
559 if ~isempty(oldName) && ~isempty(find_system(oldName,'FindAll','on','Type','Annotation','Tag','ltpda model'))
560 try
561 try cd(getappdata(0,'DefaultAnalysesDirectory')); catch, end
562 [fileName,filePath] = uiputfile([oldName,'.mdl'],'Choose destination folder');
563 fileName = [filePath,fileName];
564 save_system(oldName,fileName)
565 try cd(getappdata(0,'DefaultDataDirectory')); catch, end
566 catch
567 end
568 end
569 end
570
571 end
572 %----------------------------------------------------------------------
573
574 %----------------------------------------------------------------------
575 function hOpenCallback(varargin)
576 % This callback is called whenever the user click the 'Open' button, to
577 % retrieve a previously saved model from disk.
578
579 try
580 try cd(getappdata(0,'DefaultAnalysesDirectory')); catch, end
581 [fileName,filePath] = uigetfile('.mdl','Choose source file');
582 try cd(getappdata(0,'DefaultDataDirectory')); catch, end
583 fileName = [filePath,fileName];
584 open_system(fileName)
585 simulink
586
587 % Load the globals into memory:
588 globBlock = find_system(bdroot,'BlockType','SubSystem','Tag','globals');
589 if ~isempty(globBlock), gl = get_param(globBlock{1},'UserData'); end
590
591 % Load the nested loop variable into memory:
592 nestBlock = find_system(bdroot,'BlockType','SubSystem','Tag','nestedloops');
593 if ~isempty(nestBlock), loop = get_param(nestBlock{1},'UserData'); set(findobj('String',' Enable nested loops'),'Value',1); end
594
595 % Update the indexes inside 'Object from list':
596 inputBlockHandles = get_param(find_system(gcs,'AncestorBlock','ltpda_library/Input/Object from list'),'handle');
597 for i=1:numel(inputBlockHandles)
598 objcommand = get_param(inputBlockHandles{i},'Description');
599 if ~isempty(objcommand)
600 xx = size(LTPDAinvar,1);
601 objcommand = ['LTPDAinvar{',num2str(xx+1),',1}=',objcommand,';LTPDAinvar{',num2str(xx+1),',2}=0'];
602 eval(objcommand);
603
604 % Update the pointer inside the input block and the annotation:
605 children = get_param(inputBlockHandles{i},'Blocks');
606 inputblock = strcat(get(inputBlockHandles{i},'Path'),'/',get(inputBlockHandles{i},'Name'),'/',children{1});
607 set_param(inputblock,'Value',num2str(xx+1))
608 set_param(inputBlockHandles{i},'AttributesFormatString',num2str(xx+1));
609 end
610 end
611
612 UpdateListbox()
613 catch
614 end
615
616
617 end
618 %----------------------------------------------------------------------
619
620 %%
621 %----------------------------------------------------------------------
622 function StartExec(varargin)
623 % This callback is called whenever the user click the 'Start' button.
624
625 if isempty(bdroot) || isempty(find_system(bdroot,'FindAll','on','Type','Annotation','Tag','ltpda model')), return; end
626 button = findobj('Tag','StartButton');
627 set(button,'CData',imread('startred.jpg'),'ButtonDownFcn','');
628
629 % Check availability of inputs expected by the model:
630 inputBlocks = find_system(bdroot,'Tag','input');
631 missInputs = {};
632 for nn = 1:numel(inputBlocks)
633 innerBlocks = get_param(inputBlocks{nn},'Blocks');
634 inputVal = str2double(get_param([inputBlocks{nn},'/',innerBlocks{1}],'Value'));
635 if inputVal>size(LTPDAinvar,1) || isempty(LTPDAinvar{inputVal,1}) % one expected input is missing
636 missInputs = [missInputs;{['The block ''',inputBlocks{nn},''' expects input n�',num2str(inputVal)]}];
637 end
638 end
639 if ~isempty(missInputs)
640 screenSize = get(0,'ScreenSize');
641 backColor = [1 1 1];
642 position = [(screenSize(3)-400)/2,(screenSize(4)-160)/2,400,160];
643 inputMissFig = figure('Position',position,'Name','Input missing','Resize','off','NumberTitle','off','Toolbar','none','Menubar','none','CloseRequestFcn','uiresume; closereq');
644 uicontrol('Parent',inputMissFig,'BackgroundColor',backColor,'HorizontalAlignment','center','Position',[50 position(4)-90 position(3)-60 50],'String',{'The model expects an input, but';'none is loaded.'},'FontName','Times New Roman','FontSize',13,'FontWeight','normal','Visible','on','Style','text');
645 uicontrol('Parent',inputMissFig,'BackgroundColor',backColor,'Units','pixels','HorizontalAlignment','center','Position',[70 30 310 20],'String',missInputs,'Value',1,'Visible','on','Style','popup')
646 logosize = [40 40];
647 nobut = axes('Parent',inputMissFig,'Units','pixels','Position',[10 , position(4)-logosize(2)-60 , logosize],'Tag','No');
648 image(imread('startred.jpg'),'Parent',nobut);
649 axis(nobut,'off');
650 uiwait;
651 set(button,'CData',imread('startgreen.jpg'),'ButtonDownFcn','ltpdagui(''redraw'',1.1);');
652 return;
653 end
654
655 disp('============================')
656 disp(' Beginning the analysis')
657 disp('============================')
658 stop(timerfindall)
659 drawnow
660 currSystem = bdroot;
661 allBlocks = find_system(currSystem,'LookUnderMasks','all');
662 for i=2:numel(allBlocks), set_param(allBlocks{i},'LinkStatus','inactive'); set_param(allBlocks{i},'MaskVariables',''); end
663 addterms(currSystem)
664
665 % Check if it's a partial execution:
666 if ismember('executionList',evalin('base','who')), partialExecution = 1; else partialExecution = 0; end
667
668 % Clear the previous execution history:
669 if ~partialExecution, set_param(find_system(bdroot,'FindAll','on','Type','Annotation','Tag','ltpda model'),'UserData',''); end
670
671 % Set all objects present at the startup to be maintained:
672 if size(LTPDAinvar,1)>0, LTPDAinvar(:,2) = {1}; end
673
674 % Load the globals from the current model:
675 globBlock = find_system(bdroot,'BlockType','SubSystem','Tag','globals');
676 if ~isempty(globBlock), gl = get_param(globBlock{1},'UserData'); end
677
678 executionTime = [];
679 nestBlock = find_system(currSystem,'SearchDepth',1,'BlockType','SubSystem','Tag','nestedloops');
680
681 % Check for nested loops:
682 if ~isempty(nestBlock) && str2double(get_param(nestBlock{1},'Description'))
683 disp(' Execution in nested loops')
684 disp('============================')
685 paramLoop = get_param(nestBlock{1},'UserData');
686 % To disable unused nested loop parameters:
687 allfuncBlocks = utils.prog.find_in_models(gcs,'LookUnderMasks','all','BlockType','M-S-Function','FunctionName','ltpdasim');
688 paramLoopnumb = size(paramLoop,1);
689 enabledNestedParams = get_param(nestBlock,'MaskDescription');
690 if ~isempty(enabledNestedParams{1}), eval(enabledNestedParams{1});
691 else enabledNestedParams = ones(1,paramLoopnumb);
692 end
693 usedParamsLoop = zeros(paramLoopnumb,1);
694 for mmm = 1:paramLoopnumb
695 for nnn = 1:numel(allfuncBlocks)
696 if ~isempty(findstr(get_param(get_param(allfuncBlocks{nnn},'parent'),'Description'),paramLoop{mmm,3})), usedParamsLoop(mmm)=1; break; end
697 end
698 end
699 for mmm = paramLoopnumb:-1:1
700 if ~usedParamsLoop(mmm) || ~enabledNestedParams(mmm)
701 % then the mmm-th line in paramLoop must be removed
702 ii = mmm+1;
703 while ii <= paramLoopnumb && paramLoop{ii,2} > paramLoop{mmm,2}
704 paramLoop{ii,2} = paramLoop{ii,2}-1;
705 ii = ii+1;
706 end
707 if ~usedParamsLoop(mmm), disp(sprintf(' Parameter %s has been ignored for nested loops, being unused.',paramLoop{mmm,3}))
708 else disp(sprintf(' Parameter %s has been ignored for nested loops, being disabled.',paramLoop{mmm,3}))
709 end
710 paramLoop(mmm,:) = [];
711 usedParamsLoop(mmm) =[];
712 paramLoopnumb = paramLoopnumb-1;
713 end
714 end
715 if ~isempty(paramLoop), useNestedLoop = 1; else useNestedLoop =0; end
716 else useNestedLoop =0;
717 end
718
719 try
720 if useNestedLoop
721 % ==================================================================
722 % Execution with nested loops
723 % ==================================================================
724
725 % paramLoop has 6 columns:
726 % n� | order | parameter's name | n� of iterations | range settings | cell arrays of values
727 %
728 % Example: n� order appearance
729 % paramLoop={ 1 1 ... x-------
730 % 2 2 ... .x------
731 % 3 3 ... ..x-----
732 % 4 2 ... .x------
733 % 5 3 ... ..x-----
734 % 6 1 ... x-------
735
736 branches=[];
737
738 for ii=1:paramLoopnumb, if ii==paramLoopnumb || paramLoop{ii+1,2}<=paramLoop{ii,2}, branches=[branches,ii]; end; end
739 % 'branches' contains the ordinal number of those rows which do not have
740 % a children row, ie. the following rows have higher order.
741 % In the example above, branches = [ 3 , 5 , 6 ];
742
743 family={};
744 numbIter={};
745 for ii=1:numel(branches)
746 currOrder=paramLoop{branches(ii),2};
747 family{ii,1} = 0;
748 numbIter{ii,1} = 1;
749 for jj=branches(ii):-1:1
750 if paramLoop{jj,2}==currOrder
751 family{ii,currOrder+1} = jj;
752 family{ii,1} = family{ii,1}+1;
753 numbIter{ii,currOrder+1} = paramLoop{jj,4};
754 numbIter{ii,1} = numbIter{ii,1}*paramLoop{jj,4};
755 currOrder = paramLoop{jj,2}-1;
756 end
757 end
758 end
759 totalIter = sum(cell2mat(numbIter(:,1)));
760 currIter = 0;
761 % 'family' contains all the parents information for each branch: the
762 % first column contains how many parents there are. In the example:
763 % family = { 3 1 2 3
764 % 3 1 4 5
765 % 1 6 }
766 % Similarly, numbIter contains the number of iteration necessary to
767 % complete each param. The first column contains the total for each
768 % branch/row.
769 % numbIter = { 40 2 4 5
770 % 36 2 6 3
771 % 10 10 }
772
773 for ii=1:numel(branches)
774 x = family{ii,1}; % x = how many params to change in this branch
775 status = ones(1,x); % status shows the current step in the loop;
776 % [2,3,5] means that we've executed the 2nd value for the first param,
777 % the 3rd for the second param, and the 5th for the third param.
778
779 for iter = 1:numbIter{ii,1}
780 % ==============================================================
781 % Here goes what must be executed
782 % ==============================================================
783 currIter = currIter+1;
784 disp([' ..... starting loop ',num2str(currIter),', ',num2str(totalIter-currIter),' more to go.'])
785 statusString = ' ***** Executing now with ';
786 setappdata(0,'loopStatus',[totalIter currIter])
787 progressBar(executionTime);
788 drawnow
789
790 for mm=1:size(paramLoop,1)
791 if isempty(paramLoop{mm,7}), disp(['*** Error: default value not set for parameter ',paramLoop{mm,3}]); return; end
792 eval([paramLoop{mm,3},'=',paramLoop{mm,7},';'])
793 end
794 for nn=1:numel(status)
795 value = paramLoop{family{ii,nn+1},6}{status(nn)};
796 if ~ischar(value), value = mat2str(value); end
797 eval([paramLoop{family{ii,nn+1},3},'=', value ,';'])
798 statusString = [statusString, paramLoop{family{ii,nn+1},3}(6:end) , ' = ' , value ,'; '];
799 end
800 disp(statusString)
801 startingTime = now;
802
803 % ==============================================================
804 varargout = sim(currSystem); %#ok<NASGU>
805 % ==============================================================
806
807 executionTime = [executionTime; now-startingTime];
808
809 % Check if the user wants to stop the execution:
810 lastChar = get(findobj('Name','LTPDA Progress Bar'),'CurrentCharacter');
811 if ~isempty(lastChar) && strcmp(lastChar,'x'), break; end
812
813 for jj=x:-1:1
814 if status(jj)<numbIter{ii,jj+1} % then we still have to complete iterations on i-th row
815 status(jj)=status(jj)+1;
816 if jj~=x % if we've just increased a line which is not the last one, reset the lower lines
817 for kk=jj+1:x
818 status(kk)=1;
819 end
820 end
821 break
822 end
823 end
824 end
825 end % End of execution with nested loops
826 else % Execution without nested loops
827 if ~isempty(nestBlock) && ~str2double(get_param(nestBlock{1},'Description'))
828 % Nested loops are set but disabled
829 disp('*** Nested loops, while set, are disabled; using default values.')
830 paramLoop = get_param(nestBlock{1},'UserData');
831 for mm=1:size(paramLoop,1)
832 if isempty(paramLoop{mm,7}), disp(['*** Error: default value not set for parameter ',paramLoop{mm,3}]); return; end
833 % Setting every nested loops variable = default
834 eval([paramLoop{mm,3},'=',paramLoop{mm,7},';'])
835 disp([' ',paramLoop{mm,3},' = ',paramLoop{mm,7}])
836 end
837 end
838 setappdata(0,'loopStatus',[]);
839 progressBar();
840 drawnow
841 % ==============================================================
842 varargout = sim(currSystem); %#ok<NASGU>
843 % ==============================================================
844 end
845
846 close(findobj('Name','LTPDA Progress Bar'))
847
848 % Remove final results (intermediate were removed during analysis, as
849 % soon as they became not useful anymore):
850 if ~getappdata(0,'maintainresults') % && ~partialExecution
851 for i=size(LTPDAinvar,1):-1:1
852 if LTPDAinvar{i,2}==0
853 LTPDAinvar(i,:)=[];
854 % Update the execution history:
855 ltpda_annotation = find_system(bdroot,'FindAll','on','Type','Annotation','Tag','ltpda model');
856 execHistory = get_param(ltpda_annotation,'UserData');
857 for paramLoopnumb=1:size(execHistory,1)
858 for yy=3:size(execHistory,2),
859 if execHistory{paramLoopnumb,yy} == i, execHistory{paramLoopnumb,yy} = -1; end
860 if execHistory{paramLoopnumb,yy} > i, execHistory{paramLoopnumb,yy} = execHistory{paramLoopnumb,yy}-1; end
861 end
862 if execHistory{paramLoopnumb,1} == i, execHistory{paramLoopnumb,1} = -1; end
863 if execHistory{paramLoopnumb,1} > i, execHistory{paramLoopnumb,1} = execHistory{paramLoopnumb,1}-1; end
864 end
865 set_param(ltpda_annotation,'UserData',execHistory);
866
867 end
868 end
869 end
870
871 UpdateListbox();
872 set(button,'CData',imread('startgreen.jpg'),'ButtonDownFcn','ltpdagui(''redraw'',1.1);');
873 evalin('base','clear executionList');
874 disp('============================')
875 disp(' Analysis concluded')
876 disp('============================')
877 start(timerfindall)
878
879 % ==================================
880 catch ME
881 % ==================================
882
883 % Remove anyway intermediate results:
884 keepRes = getappdata(0,'maintainresults');
885 if ~keepRes, for i=size(LTPDAinvar,1):-1:1, if LTPDAinvar{i,2}==0, LTPDAinvar(i,:)=[]; end; end; end
886
887 UpdateListbox();
888 close(findobj('Name','LTPDA Progress Bar'))
889 set(button,'CData',imread('startgreen.jpg'),'ButtonDownFcn','ltpdagui(''redraw'',1.1);');
890 evalin('base','clear executionList');
891 start(timerfindall)
892
893 rethrow(ME)
894 end
895
896 end
897 %----------------------------------------------------------------------
898 %%
899
900 end