0001 function varargout = pan5output(varargin)
0002
0003
0004
0005
0006
0007
0008
0009
0010 global LTPDAoutvar
0011
0012 InputObjList=''; OutputObjList='';
0013 UpdateListbox();
0014
0015 currPanel = varargin{1};
0016 panelDimens = get(currPanel, 'Position');
0017 backColor = get(currPanel, 'BackgroundColor');
0018
0019 DataPanPos = [20 panelDimens(4)-320 panelDimens(3)-40 285];
0020 hDataPanel = uipanel(...
0021 'Title','Data Control Panel',...
0022 'BackgroundColor',[1,1,1],...
0023 'FontSize',7,...
0024 'Units','pixels',...
0025 'Position',DataPanPos);
0026 nbuttons = 5;
0027 buttonWidth = (DataPanPos(3)-10*(nbuttons+1))/nbuttons;
0028 buttonPos = [10 DataPanPos(4)-45 buttonWidth 25];
0029 hExportButton = uicontrol('Parent',hDataPanel,'Units','pixels','HorizontalAlignment','center','Position',buttonPos,'String','Export to workspace','FontSize',8,'Visible','on','Callback',@hExportButtonCallback,'Style','pushbutton','enable','on');
0030 buttonPos(1) = buttonPos(1)+buttonWidth+10;
0031 hRemoveButton = uicontrol('Parent',hDataPanel,'Units','pixels','HorizontalAlignment','center','Position',buttonPos,'String','Remove','FontSize',8,'Visible','on','Callback',@hRemoveButtonCallback,'Style','pushbutton','enable','off');
0032 buttonPos(1) = buttonPos(1)+buttonWidth+10;
0033 hRepoButton = uicontrol('Parent',hDataPanel,'Units','pixels','HorizontalAlignment','center','Position',buttonPos,'String','Send to repository','FontSize',8,'Visible','on','Callback',@hClearButtonCallback,'Style','pushbutton','enable','off');
0034 buttonPos(1) = buttonPos(1)+buttonWidth+10;
0035 hExploreButton = uicontrol('Parent',hDataPanel,'Units','pixels','HorizontalAlignment','center','Position',buttonPos,'String','Explore','FontSize',8,'Visible','on','UserData',InputObjList,'Callback',@hExploreButtonCallback,'Style','pushbutton','enable','off');
0036
0037
0038 buttonPos(1) = buttonPos(1)+buttonWidth+10;
0039 hClearButton = uicontrol('Parent',hDataPanel,'Units','pixels','HorizontalAlignment','center','Position',buttonPos,'String','Clear output','FontSize',8,'Visible','on','Enable','on','Callback',@hClearButtonCallback,'Style','pushbutton');
0040 clear nbuttons buttonWidth buttonPos
0041
0042
0043 ntexts = 2;
0044 textWidth = (DataPanPos(3)-10*(ntexts+1))/ntexts;
0045 textPos = [10 DataPanPos(4)-80 textWidth 25];
0046
0047 textPos(1) = textPos(1)+textWidth+10;
0048 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');
0049 clear ntexts textWidth textPos
0050
0051
0052 nlists = 2;
0053 listWidth = (DataPanPos(3)-10*(nlists+1))/nlists;
0054 listPos = [10 DataPanPos(4)-275 listWidth 200];
0055
0056 uicontrol('Parent',hDataPanel,'BackgroundColor',[0.94,0.94,1],'Style','text','HorizontalAlignment', 'left','Fontsize', 7,'Units','pixels','Position',listPos,'Tag','infoPanel');
0057 listPos(1) = listPos(1)+listWidth+10;
0058 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');
0059 hResultListCallback(OutputObjList,1)
0060 clear DataPanPos nlists listWidth listPos
0061
0062
0063
0064
0065 function UpdateListbox(varargin)
0066
0067
0068
0069
0070 xx = size(LTPDAoutvar,1);
0071 listResults = cell(xx,1);
0072 if xx>0
0073 for j=1:xx
0074 switch class(LTPDAoutvar{j,1})
0075 case 'ao'
0076 anobject = LTPDAoutvar{j,1};
0077 aoname = anobject.name;
0078 aocreated = get(get(anobject.provenance, 'created'),'time_str');
0079 listResults{j,1} = [num2str(j) , ' . AO .' , aoname , '__' , aocreated];
0080 case 'plist'
0081 paramNumb = nparams(LTPDAoutvar{j,1});
0082 objcreated = get(LTPDAoutvar{j,1}.created,'time_str');
0083 listResults{j,1}=[num2str(j),' . PLIST .',num2str(paramNumb),' params','__',objcreated];
0084 case 'specwin'
0085 listResults{j,1}=[num2str(j),' . SPECWIN .','__','no creation time'];
0086 case 'pzmodel'
0087 objcreated = get(LTPDAoutvar{j,1}.created,'time_str');
0088 listResults{j,1}=[num2str(j),' . PZMODEL .','__',objcreated];
0089 case 'miir'
0090 objcreated = get(LTPDAoutvar{j,1}.created,'time_str');
0091 listResults{j,1}=[num2str(j),' . MIIR .','__',objcreated];
0092 otherwise
0093 if ltpda_isuserobject(LTPDAoutvar{j,1})
0094 objclass = class(LTPDAoutvar{j,1});
0095 if ~isempty(LTPDAoutvar{j,1}), listResults{j,1}=[num2str(j),' . ',objclass]; end
0096 end
0097 end
0098 end
0099 for j=xx:-1:1
0100 if isempty(listResults{j,1})
0101 listResults(j,:)=[];
0102 end
0103 end
0104 else
0105 listResults{1,1}='The memory is empty';
0106 end
0107
0108 OutputObjList = findobj('Tag','OutputObjList');
0109 if ~isempty(OutputObjList)
0110 set(OutputObjList,'Value',1)
0111 set(OutputObjList,'String',listResults)
0112 end
0113
0114
0115
0116 end
0117
0118
0119
0120
0121 function hResultListCallback(hObject, varargin)
0122
0123
0124 if ~isempty(varargin{1}) && varargin{1}==1 && size(LTPDAoutvar,1)>0
0125 val = get(hObject, 'Value');
0126 if length(val) == 1
0127 objLines = get(hObject, 'String');
0128 if isempty(objLines)
0129 objtxt = '';
0130 else
0131 objnumb = str2double(deblank(strtok(objLines{val})));
0132 objtxt = display(LTPDAoutvar{objnumb});
0133 end
0134 else
0135 objtxt = '';
0136 end
0137 set(findobj('Tag', 'infoPanel'), 'String', objtxt)
0138 elseif size(LTPDAoutvar,1)>0
0139 if strcmp(get(gcf,'SelectionType'),'normal')
0140 val = get(hObject, 'Value');
0141 if length(val) == 1
0142 objLines = get(hObject, 'String');
0143 objnumb = str2double(deblank(strtok(objLines{val})));
0144 objtxt = display(LTPDAoutvar{objnumb});
0145 else
0146 objtxt = '';
0147 end
0148 set(findobj('Tag', 'infoPanel'), 'String', objtxt)
0149 end
0150 if strcmp(get(gcf,'SelectionType'),'open') && ~isempty(get(hObject, 'String'))
0151 currAO=get(hObject,'Value');
0152 figure
0153 plot(LTPDAoutvar{currAO,1});
0154 end
0155 end
0156
0157 end
0158
0159
0160
0161
0162
0163
0164
0165
0166
0167
0168
0169
0170
0171
0172
0173
0174
0175 function hClearButtonCallback(varargin)
0176
0177
0178
0179 LTPDAoutvar={};
0180 set(OutputObjList,'Value',1)
0181 set(findobj('Tag', 'infoPanel'), 'String', '')
0182 UpdateListbox();
0183
0184 end
0185
0186
0187
0188 function hExportButtonCallback(varargin)
0189
0190
0191 currSelObjs = get(OutputObjList,'Value');
0192 listAOs = get(OutputObjList,'String');
0193 if ~strcmp(listAOs,'The memory is empty')
0194 selectedObjs = [];
0195 for i=1:numel(currSelObjs)
0196 objSelect = str2double(strtok(listAOs{currSelObjs(i),1},'.'));
0197 selectedObjs = [selectedObjs,LTPDAoutvar{objSelect,1}];
0198 end
0199 if ~isempty(selectedObjs)
0200 for i=1:numel(selectedObjs)
0201 objName = [class(selectedObjs(i)),'_',selectedObjs(i).name];
0202 objName = genvarname(objName,evalin('base','who'));
0203 assignin('base', objName, selectedObjs(i));
0204 disp(['Saved to workspace with name ',objName])
0205 end
0206 end
0207 end
0208
0209 end
0210
0211
0212
0213 end