0
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1 function pan5output(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
3 % ========================================================================
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
4 % ====================== Panel for the outputs ===========================
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
5 % ========================================================================
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
6 % This is the GUI m-file to show that the panel relative to the outputs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
7 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
8 % $Id: pan5output.m,v 1.17 2008/12/16 19:30:26 nicola Exp $
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
9
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
10 global LTPDAoutvar
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
11
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
12 InputObjList=''; OutputObjList='';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
13 UpdateListbox();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
14 set(gcf,'NextPlot','new');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
15
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
16 currPanel = varargin{1};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
17 panelDimens = get(currPanel, 'Position');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
18 backColor = get(currPanel, 'BackgroundColor');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
19
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
20 DataPanPos = [20 panelDimens(4)-320 panelDimens(3)-40 285];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
21 hDataPanel = uipanel(...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
22 'Title','Data Control Panel',...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
23 'BackgroundColor',[1,1,1],...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
24 'FontSize',7,...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
25 'Units','pixels',...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
26 'Position',DataPanPos);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
27 nbuttons = 5;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
28 buttonWidth = (DataPanPos(3)-10*(nbuttons+1))/nbuttons;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
29 buttonPos = [10 DataPanPos(4)-45 buttonWidth 25];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
30 % 'Export to workspace' button:
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
31 uicontrol('Parent',hDataPanel,'Units','pixels','HorizontalAlignment','center','Position',buttonPos,'String','Export to workspace','FontSize',8,'Visible','on','Callback',@hExportButtonCallback,'Style','pushbutton','enable','on');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
32 buttonPos(1) = buttonPos(1)+buttonWidth+10;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
33 % 'Remove' button:
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
34 uicontrol('Parent',hDataPanel,'Units','pixels','HorizontalAlignment','center','Position',buttonPos,'String','Remove','FontSize',8,'Visible','on','Callback',@hRemoveButtonCallback,'Style','pushbutton','enable','on');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
35 buttonPos(1) = buttonPos(1)+buttonWidth+10;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
36 % 'Send to repository' button:
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
37 uicontrol('Parent',hDataPanel,'Units','pixels','HorizontalAlignment','center','Position',buttonPos,'String','Send to repository','FontSize',8,'Visible','on','Callback',@hClearButtonCallback,'Style','pushbutton','enable','off');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
38 buttonPos(1) = buttonPos(1)+buttonWidth+10;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
39 % 'Explore' button:
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
40 uicontrol('Parent',hDataPanel,'Units','pixels','HorizontalAlignment','center','Position',buttonPos,'String','Explore','FontSize',8,'Visible','on','UserData',InputObjList,'Callback',@hExploreButtonCallback,'Style','pushbutton','enable','on');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
41 % buttonPos(1) = buttonPos(1)+buttonWidth+10;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
42 % hSaveOutButton = uicontrol('Parent',hDataPanel,'Units','pixels','HorizontalAlignment','center','Position',buttonPos,'String','Save workspace','FontSize',8,'Visible','on','Enable','on','Callback',@SaveWorkspaceCallback,'Style','pushbutton');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
43 buttonPos(1) = buttonPos(1)+buttonWidth+10;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
44 % 'Clear all output' button:
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
45 uicontrol('Parent',hDataPanel,'Units','pixels','HorizontalAlignment','center','Position',buttonPos,'String','Clear output','FontSize',8,'Visible','on','Enable','on','Callback',{@AskConfirm,'clear'},'Style','pushbutton');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
46 clear nbuttons buttonWidth buttonPos
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
47
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
48
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
49 ntexts = 2;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
50 textWidth = (DataPanPos(3)-10*(ntexts+1))/ntexts;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
51 textPos = [10 DataPanPos(4)-80 textWidth 25];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
52 % hListAOText = uicontrol('Parent',hDataPanel,'BackgroundColor',get(hDataPanel,'BackgroundColor'),'HorizontalAlignment','center','Position',textPos,'String','Input:','FontName','Times New Roman','FontSize',8,'FontWeight','normal','Visible','on','Style','text');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
53 textPos(1) = textPos(1)+textWidth+10;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
54 hResultAOText = uicontrol('Parent',hDataPanel,'BackgroundColor',get(hDataPanel,'BackgroundColor'),'HorizontalAlignment','center','Position',textPos,'String','Output:','FontName','Times New Roman','FontSize',8,'FontWeight','normal','Visible','on','Style','text');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
55 clear ntexts textWidth textPos
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
56
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
57
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
58 nlists = 2;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
59 listWidth = (DataPanPos(3)-10*(nlists+1))/nlists;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
60 listPos = [10 DataPanPos(4)-275 listWidth 200];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
61 % Info panel:
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
62 uicontrol('Parent',hDataPanel,'BackgroundColor',[0.94,0.94,1],'Style','listbox','HorizontalAlignment', 'left','Fontsize', 8,'Units','pixels','Position',listPos,'Tag','infoPanel');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
63 listPos(1) = listPos(1)+listWidth+10;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
64 OutputObjList = uicontrol('Parent',hDataPanel,'BackgroundColor',[0.95,0.95,0.95],'HorizontalAlignment','center','Position',listPos,'String',listResults,'Value',[],'Max',10,'Min',1,'FontSize',8,'FontWeight','normal','Visible','on','Callback',@hResultListCallback,'Tag','OutputObjList','Style','listbox');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
65 hResultListCallback(OutputObjList,1)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
66 clear DataPanPos nlists listWidth listPos
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
67
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
68
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
69 %%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
70 %----------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
71 function UpdateListbox(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
72 % Updates the LTPDAoutvar listbox
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
73
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
74 %==================================
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
75 % Update the list of results AOs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
76 xx = size(LTPDAoutvar,1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
77 listResults = cell(xx,1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
78 if xx>0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
79 for j=1:xx
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
80 listResults{j,1} = num2str(j);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
81 [rows,columns] = size(LTPDAoutvar{j,1});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
82 if (rows>1 && columns==1) || (rows==1 && columns>1), listResults{j,1} = [listResults{j,1}, ' .(Vector ',num2str(rows),'x',num2str(columns),') '];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
83 elseif rows>1 && columns>1, listResults{j,1} = [listResults{j,1}, ' .(Matrix ',num2str(rows),'x',num2str(columns),') '];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
84 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
85 switch class(LTPDAoutvar{j,1})
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
86 case 'ao'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
87 anobject = LTPDAoutvar{j,1};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
88 aoname = anobject.name;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
89 aocreated = char(anobject.created);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
90 listResults{j,1} = [listResults{j,1}, ' . AO .' , aoname , '__' , aocreated];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
91 case 'plist'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
92 paramNumb = nparams(LTPDAoutvar{j,1});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
93 objcreated = char(LTPDAoutvar{j,1}.created);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
94 listResults{j,1}=[listResults{j,1}, ' . PLIST .',num2str(paramNumb),' params','__',objcreated];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
95 case {'pzmodel','miir','mfir'}
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
96 objcreated = char(LTPDAoutvar{j,1}.created);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
97 listResults{j,1}=[listResults{j,1}, ' . ',upper(class(LTPDAoutvar{j,1})),' .__',objcreated];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
98 case 'double'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
99 if numel(LTPDAoutvar{j,1})==1, objclass = ' . Scalar .__ ';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
100 elseif size(LTPDAoutvar{j,1},1)==1 || size(LTPDAoutvar{j,1},2)==1, objclass = ' . Vector .__ ';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
101 else objclass = ' . Matrix .__ ';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
102 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
103 listResults{j,1}=[listResults{j,1}, objclass, mat2str(LTPDAoutvar{j,1})];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
104 otherwise
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
105 listResults{j,1}=[listResults{j,1}, ' . ',class(LTPDAoutvar{j,1})];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
106 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
107 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
108 for j=xx:-1:1, if isempty(listResults{j,1}), listResults(j,:)=[]; end; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
109 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
110 listResults{1,1}='The workspace is empty';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
111 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
112
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
113 OutputObjList = findobj('Tag','OutputObjList');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
114 if ~isempty(OutputObjList)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
115 set(OutputObjList,'Value',1)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
116 set(OutputObjList,'String',listResults)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
117 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
118
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
119 %==================================
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
120
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
121 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
122 %----------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
123
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
124 %----------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
125 function hResultListCallback(hObject, varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
126 % This callback is called whenever the user double click upon one of
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
127 % the AOs in use.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
128 if ~isempty(varargin{1}) && varargin{1}==1 && size(LTPDAoutvar,1)>0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
129 val = get(hObject, 'Value');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
130 if length(val) == 1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
131 objLines = get(hObject, 'String');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
132 if isempty(objLines)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
133 objtxt = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
134 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
135 objnumb = str2double(deblank(strtok(objLines{val})));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
136 objtxt = display(LTPDAoutvar{objnumb});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
137 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
138 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
139 objtxt = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
140 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
141 set(findobj('Tag', 'infoPanel'), 'String', objtxt)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
142 elseif size(LTPDAoutvar,1)>0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
143 if strcmp(get(gcf,'SelectionType'),'normal')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
144 val = get(hObject, 'Value');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
145 if length(val) == 1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
146 objLines = get(hObject, 'String');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
147 objnumb = str2double(deblank(strtok(objLines{val})));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
148 objtxt = display(LTPDAoutvar{objnumb});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
149 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
150 objtxt = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
151 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
152 set(findobj('Tag', 'infoPanel'), 'String', objtxt)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
153 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
154 if strcmp(get(gcf,'SelectionType'),'open') && ~isempty(get(hObject, 'String'))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
155 try %#ok<ALIGN>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
156 currIndex = get(hObject,'Value');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
157 figure
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
158 plot(LTPDAoutvar{currIndex,1});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
159 catch
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
160 close(gcf)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
161 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
162 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
163 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
164
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
165 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
166 %----------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
167
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
168 %%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
169 % %----------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
170 % function SaveWorkspaceCallback(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
171 % % Callback function: run when the user click the "Clear all data"
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
172 % % button
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
173 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
174 % try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
175 % [FileName,PathName,FilterIndex] = uiputfile('*.mat','Save Workspace As');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
176 % if ~isa(FileName,'double'), save(strcat(PathName,FileName),'LTPDAoutvar'); disp('Workspace saved'); end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
177 % disp('Output saved')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
178 % catch
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
179 % end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
180 % end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
181 % %----------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
182
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
183 %----------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
184 function AskConfirm(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
185 % Whenever the user click the Reset Parameters button
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
186
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
187 if strcmp(varargin{3},'close'), set(gcf,'Visible','off'); end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
188
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
189 % Ask for confirmation:
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
190 screenSize = get(0,'ScreenSize');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
191 backColor = [1 1 1];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
192 position = [(screenSize(3)-250)/2,(screenSize(4)-160)/2,250,160];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
193 confirmFig = figure('Position',position,'Name','Please confirm','Tag','ConfirmReset','Resize','off','NumberTitle','off','Toolbar','none','Menubar','none');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
194 % Text
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
195 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');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
196 % Button Yes
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
197 dimension = position;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
198 logosize = [77 95];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
199 dimension = [50 , dimension(4)-logosize(2)-50 , logosize];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
200 yesbut = axes('Parent',confirmFig,'Units','pixels','Position',dimension,'Tag','Yes');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
201 image(imread('buttonyes2.jpg'),'Parent',yesbut,'ButtonDownFcn','set(findobj(''Tag'',''ConfirmReset''),''UserData'',0); uiresume;','Tag','YesButton');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
202 axis(yesbut,'off');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
203 % Button No
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
204 dimension = position;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
205 logosize = [77 95];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
206 dimension = [127 , dimension(4)-logosize(2)-50 , logosize];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
207 nobut = axes('Parent',confirmFig,'Units','pixels','Position',dimension,'Tag','No');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
208 image(imread('buttonno2.jpg'),'Parent',nobut,'ButtonDownFcn','set(findobj(''Tag'',''ConfirmReset''),''UserData'',1); uiresume;','Tag','NoButton');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
209 axis(nobut,'off');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
210
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
211 uiwait;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
212
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
213 if get(confirmFig,'UserData'), delete(confirmFig); set(findobj('Tag','LTPDAGUI'),'Visible','on'); return; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
214
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
215 if strcmp(varargin{3},'close')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
216 delete(confirmFig);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
217 disp('Closing LTPDA GUI...');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
218 delete(timerfindall);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
219 clear global LTPDAinvar LTPDAoutvar;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
220 setappdata(0,'ltpda_repo_user',''); setappdata(0,'ltpda_repo_pass','');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
221 closereq
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
222 elseif strcmp(varargin{3},'clear')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
223 delete(confirmFig);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
224 LTPDAoutvar={};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
225 set(OutputObjList,'Value',1)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
226 set(findobj('Tag', 'infoPanel'), 'String', '')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
227 set_param(find_system(bdroot,'FindAll','on','Type','Annotation','Tag','ltpda model'),'UserData','');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
228 UpdateListbox();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
229 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
230
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
231 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
232 %----------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
233
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
234 %----------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
235 function hRemoveButtonCallback(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
236 % Callback function: run when the user click the "Remove data" button
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
237
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
238 index_selected = get(OutputObjList,'Value');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
239 listObjs = get(OutputObjList,'String');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
240 if ~strcmp(listObjs,'The memory is empty')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
241 for i=1:numel(index_selected)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
242 objSelect = str2double(strtok(listObjs{index_selected(i),1},'.'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
243 LTPDAoutvar(objSelect,:) = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
244 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
245 UpdateListbox();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
246 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
247 set(findobj('Tag', 'infoPanel'), 'String', '')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
248
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
249 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
250 %----------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
251
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
252 %----------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
253 function hExportButtonCallback(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
254 % Callback function: run when the user click the "Remove data" button
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
255
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
256 currSelObjs = get(OutputObjList,'Value');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
257 listObjs = get(OutputObjList,'String');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
258 if ~strcmp(listObjs,'The memory is empty')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
259 selectedObjs = {};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
260 for i=1:numel(currSelObjs)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
261 objSelect = str2double(strtok(listObjs{currSelObjs(i),1},'.'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
262 selectedObjs = [selectedObjs,LTPDAoutvar(objSelect,1)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
263 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
264 if ~isempty(selectedObjs)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
265 for i=1:numel(selectedObjs)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
266 objName = [class(selectedObjs{i}),'_',selectedObjs{i}.name];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
267 objName = genvarname(objName,evalin('base','who'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
268 assignin('base', objName, selectedObjs{i});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
269 disp(['Saved to workspace with name ',objName])
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
270 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
271 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
272 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
273
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
274 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
275 %----------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
276
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
277 %----------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
278 function hExploreButtonCallback(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
279 % Callback function: run when the user click the "Update list" button
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
280
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
281 currSelObjs = get(OutputObjList,'Value');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
282 listObjs = get(OutputObjList,'String');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
283 if ~strcmp(listObjs,'The memory is empty')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
284 selectedObjs = {};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
285 for i=1:numel(currSelObjs)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
286 objSelect = str2double(strtok(listObjs{currSelObjs(i),1},'.'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
287 selectedObjs = [selectedObjs,LTPDAoutvar(objSelect,1)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
288 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
289
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
290 if ~isempty(selectedObjs)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
291 ltpda_explorer(selectedObjs);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
292 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
293 ltpda_explorer(LTPDAoutvar);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
294 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
295
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
296 UpdateListbox();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
297 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
298
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
299 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
300 %----------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
301
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
302
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
303 %%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
304 end |