[569] | 1 | %'browse_data': function for scanning directories in a campaign |
---|
| 2 | %------------------------------------------------------------------------ |
---|
| 3 | % function varargout = series(varargin) |
---|
| 4 | % associated with the GUI browse_data.fig |
---|
| 5 | |
---|
| 6 | %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
---|
| 7 | % Copyright Joel Sommeria, 2008, LEGI / CNRS-UJF-INPG, sommeria@coriolis-legi.org. |
---|
| 8 | %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
---|
| 9 | % This file is part of the toolbox UVMAT. |
---|
| 10 | % |
---|
| 11 | % UVMAT is free software; you can redistribute it and/or modify |
---|
| 12 | % it under the terms of the GNU General Public License as published by |
---|
| 13 | % the Free Software Foundation; either version 2 of the License, or |
---|
| 14 | % (at your option) any later version. |
---|
| 15 | % |
---|
| 16 | % UVMAT is distributed in the hope that it will be useful, |
---|
| 17 | % but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 18 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 19 | % GNU General Public License (file UVMAT/COPYING.txt) for more details. |
---|
| 20 | %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
---|
| 21 | |
---|
| 22 | function varargout = browse_data(varargin) |
---|
| 23 | |
---|
[581] | 24 | % Last Modified by GUIDE v2.5 07-Mar-2013 18:55:00 |
---|
[569] | 25 | |
---|
| 26 | % Begin initialization code - DO NOT EDIT |
---|
| 27 | gui_Singleton = 1; |
---|
| 28 | gui_State = struct('gui_Name', mfilename, ... |
---|
| 29 | 'gui_Singleton', gui_Singleton, ... |
---|
| 30 | 'gui_OpeningFcn', @browse_data_OpeningFcn, ... |
---|
| 31 | 'gui_OutputFcn', @browse_data_OutputFcn, ... |
---|
| 32 | 'gui_LayoutFcn', [] , ... |
---|
| 33 | 'gui_Callback', []); |
---|
| 34 | if nargin && ischar(varargin{1}) && ~isempty(regexp(varargin{1},'_Callback','once')) |
---|
| 35 | gui_State.gui_Callback = str2func(varargin{1}); |
---|
| 36 | end |
---|
| 37 | |
---|
| 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 | %------------------------------------------------------------------------ |
---|
| 46 | % --- Executes just before browse_data is made visible. |
---|
[571] | 47 | function browse_data_OpeningFcn(hObject, eventdata, handles, Campaign) |
---|
[569] | 48 | %------------------------------------------------------------------------ |
---|
[581] | 49 | |
---|
| 50 | %% Choose default command line output for browse_data |
---|
[569] | 51 | handles.output = 'Cancel'; |
---|
| 52 | |
---|
[581] | 53 | %% Update handles structure |
---|
[569] | 54 | guidata(hObject, handles); |
---|
[581] | 55 | set(hObject,'WindowButtonDownFcn',{'mouse_down'}) % allows mouse action with right button (zoom for uicontrol display) |
---|
[569] | 56 | |
---|
[581] | 57 | %% Determine the position of the dialog - centered on the screen |
---|
[569] | 58 | FigPos=get(0,'DefaultFigurePosition'); |
---|
| 59 | OldUnits = get(hObject, 'Units'); |
---|
| 60 | set(hObject, 'Units', 'pixels'); |
---|
| 61 | OldPos = get(hObject,'Position'); |
---|
| 62 | FigWidth = OldPos(3); |
---|
| 63 | FigHeight = OldPos(4); |
---|
| 64 | ScreenUnits=get(0,'Units'); |
---|
| 65 | set(0,'Units','pixels'); |
---|
| 66 | ScreenSize=get(0,'ScreenSize'); |
---|
| 67 | set(0,'Units',ScreenUnits); |
---|
| 68 | FigPos(1)=1/2*(ScreenSize(3)-FigWidth); |
---|
| 69 | FigPos(2)=2/3*(ScreenSize(4)-FigHeight); |
---|
| 70 | FigPos(3:4)=[FigWidth FigHeight]; |
---|
| 71 | set(hObject, 'Position', FigPos); |
---|
| 72 | set(hObject, 'Units', OldUnits); |
---|
[571] | 73 | % |
---|
| 74 | % if exist('GeometryCalib','var') |
---|
| 75 | % DataviewData.GeometryCalib=GeometryCalib; |
---|
| 76 | % set(hObject,'UserData',DataviewData) |
---|
| 77 | % end |
---|
[569] | 78 | if exist('Campaign','var') |
---|
| 79 | [CampaignPath,CampaignName]=fileparts(Campaign); |
---|
| 80 | RootXml=fullfile(Campaign,[CampaignName '.xml']); |
---|
| 81 | s=[]; |
---|
| 82 | if exist(RootXml,'file') |
---|
| 83 | [s,Heading]=xml2struct(RootXml);%read the xml file |
---|
| 84 | if isfield(s,'SourceDir') |
---|
| 85 | set(handles.SourceDir,'String',s.SourceDir);%display the source dir if a mirror has been opened |
---|
| 86 | set(handles.MirrorDir,'Visible','on');% mirror dir display |
---|
| 87 | set(handles.MirrorDir,'String',Campaign);%display the opened mirror dir |
---|
| 88 | set(handles.CreateMirror,'String','update_mirror') |
---|
| 89 | end |
---|
| 90 | end |
---|
| 91 | if isempty(s) %a source dir has been opened |
---|
| 92 | set(handles.SourceDir,'String',Campaign); |
---|
| 93 | set(handles.MirrorDir,'Visible','off');% no mirror dir display |
---|
| 94 | set(handles.CreateMirror,'String','create_mirror') |
---|
| 95 | end |
---|
[570] | 96 | scan_campaign(handles,Campaign) |
---|
[569] | 97 | set(handles.OK,'Visible','on') |
---|
| 98 | set(handles.Cancel,'Visible','on') |
---|
[581] | 99 | set(handles.browse_data,'WindowStyle','modal')% Make the GUI modal |
---|
[569] | 100 | set(hObject,'Visible','on') |
---|
| 101 | drawnow |
---|
| 102 | % UIWAIT makes GUI wait for user response (see UIRESUME) |
---|
[581] | 103 | uiwait(handles.browse_data); |
---|
[569] | 104 | end |
---|
| 105 | |
---|
| 106 | %------------------------------------------------------------------------ |
---|
| 107 | % --- Outputs from this function are returned to the command line. |
---|
| 108 | function varargout = browse_data_OutputFcn(hObject, eventdata, handles) |
---|
| 109 | %------------------------------------------------------------------------ |
---|
| 110 | % Get default command line output from handles structure |
---|
| 111 | varargout{1} = handles.output; |
---|
[581] | 112 | delete(handles.browse_data) |
---|
[569] | 113 | |
---|
| 114 | %------------------------------------------------------------------------ |
---|
| 115 | % --- Executes on button press in CreateMirror. |
---|
| 116 | function CreateMirror_Callback(hObject, eventdata, handles) |
---|
| 117 | %------------------------------------------------------------------------ |
---|
[571] | 118 | SourceDir=get(handles.SourceDir,'String'); |
---|
| 119 | [SourcePath,ProjectName]=fileparts(SourceDir); |
---|
| 120 | if strcmp(get(handles.MirrorDir,'Visible'),'on') |
---|
| 121 | MirrorDir=get(handles.MirrorDir,'String'); |
---|
| 122 | else |
---|
[569] | 123 | MirrorRoot=uigetdir('','select the dir which must contain the mirror directory, then press OK'); %file browser |
---|
| 124 | if ~ischar(MirrorRoot) |
---|
| 125 | return |
---|
| 126 | else |
---|
| 127 | MirrorDir=fullfile(MirrorRoot,ProjectName); |
---|
| 128 | end |
---|
| 129 | if ~exist(MirrorDir,'dir') |
---|
| 130 | mkdir(MirrorDir) |
---|
| 131 | end |
---|
| 132 | MirrorDoc.SourceDir=SourceDir; |
---|
| 133 | t=struct2xml(MirrorDoc); |
---|
| 134 | set(t,1,'name','DataTree'); |
---|
| 135 | save(t,fullfile(MirrorDir,[ProjectName '.xml'])) |
---|
| 136 | set(handles.MirrorDir,'String',MirrorDir) |
---|
| 137 | set(handles.MirrorDir,'Visible','on') |
---|
| 138 | end |
---|
| 139 | set(handles.SourceDir,'BackgroundColor',[1 1 0]) |
---|
| 140 | drawnow |
---|
| 141 | ExpName={''}; |
---|
| 142 | if exist(SourceDir,'dir') |
---|
| 143 | hdir=dir(SourceDir); %list files and dirs |
---|
| 144 | idir=0; |
---|
| 145 | for ilist=1:length(hdir) |
---|
| 146 | if hdir(ilist).isdir |
---|
| 147 | dirname=hdir(ilist).name; |
---|
| 148 | if ~isequal(dirname(1),'.')&&~isequal(dirname(1),'0') |
---|
| 149 | idir=idir+1; |
---|
| 150 | ExpName{idir}=hdir(ilist).name; |
---|
[571] | 151 | |
---|
[569] | 152 | mirror=fullfile(MirrorDir,ExpName{idir}); |
---|
| 153 | if ~exist(mirror,'dir') |
---|
| 154 | mkdir(mirror) |
---|
| 155 | end |
---|
| 156 | end |
---|
| 157 | % look for the list of 'devices' |
---|
| 158 | else |
---|
| 159 | %warning for isolated files |
---|
| 160 | end |
---|
| 161 | end |
---|
| 162 | set(handles.ListExperiments,'String',[{'*'};ExpName']) |
---|
| 163 | set(handles.ListExperiments,'Value',1) |
---|
| 164 | ListExperiments_Callback(hObject, eventdata, handles) |
---|
| 165 | else |
---|
| 166 | msgbox_uvmat('ERROR',['The input ' SourceDir ' is not a directory']) |
---|
| 167 | end |
---|
| 168 | set(handles.SourceDir,'BackgroundColor',[1 1 1]) |
---|
| 169 | |
---|
| 170 | |
---|
[589] | 171 | % %------------------------------------------------------------------------ |
---|
| 172 | % function MirrorDir_Callback(hObject, eventdata, handles) |
---|
| 173 | % %------------------------------------------------------------------------ |
---|
| 174 | % MirrorDir=get(handles.MirrorDir,'String'); |
---|
| 175 | % [tild,MirrorName]=fileparts(MirrorDir); |
---|
| 176 | % s=xml2struct(fullfile(MirrorDir,[MirrorName '.xml'])); |
---|
| 177 | % set(handles.SourceDir,'String',s.SourceDir) |
---|
| 178 | % SourceDir_Callback([],[], handles) |
---|
[569] | 179 | |
---|
| 180 | |
---|
| 181 | %------------------------------------------------------------------------ |
---|
[570] | 182 | function scan_campaign(handles,Campaign) |
---|
[569] | 183 | %------------------------------------------------------------------------ |
---|
[570] | 184 | %set(handles.SourceDir,'BackgroundColor',[1 1 0]) |
---|
[569] | 185 | drawnow |
---|
[570] | 186 | %SourceDir=get(handles.SourceDir,'String'); |
---|
| 187 | %MirrorDir=get(handles.MirrorDir,'String'); |
---|
[569] | 188 | ExpName={''}; |
---|
[570] | 189 | if exist(Campaign,'dir') |
---|
| 190 | hdir=dir(Campaign); %list files and dirs |
---|
[569] | 191 | idir=0; |
---|
| 192 | for ilist=1:length(hdir) |
---|
| 193 | if hdir(ilist).isdir |
---|
| 194 | dirname=hdir(ilist).name; |
---|
| 195 | if ~isequal(dirname(1),'.')&&~isequal(dirname(1),'0') |
---|
| 196 | idir=idir+1; |
---|
| 197 | ExpName{idir}=hdir(ilist).name; |
---|
| 198 | end |
---|
| 199 | end |
---|
| 200 | end |
---|
| 201 | set(handles.ListExperiments,'String',[{'*'};ExpName']) |
---|
| 202 | set(handles.ListExperiments,'Value',1) |
---|
[570] | 203 | ListExperiments_Callback([],[], handles) |
---|
[569] | 204 | else |
---|
[570] | 205 | msgbox_uvmat('ERROR',['The input ' Campaign ' is not a directory']) |
---|
[569] | 206 | end |
---|
[570] | 207 | %set(handles.SourceDir,'BackgroundColor',[1 1 1]) |
---|
[569] | 208 | |
---|
| 209 | |
---|
| 210 | %------------------------------------------------------------------------ |
---|
| 211 | % --- Executes on selection change in ListExperiments. |
---|
| 212 | function ListExperiments_Callback(hObject, eventdata, handles) |
---|
| 213 | %------------------------------------------------------------------------ |
---|
[589] | 214 | MirrorPath=''; |
---|
| 215 | CampaignPath=get(handles.SourceDir,'String'); |
---|
[571] | 216 | if strcmp(get(handles.MirrorDir,'Visible'),'on') |
---|
[589] | 217 | % CampaignPath=get(handles.MirrorDir,'String'); |
---|
| 218 | MirrorPath=get(handles.MirrorDir,'String'); |
---|
[571] | 219 | else |
---|
[589] | 220 | % CampaignPath=get(handles.SourceDir,'String'); |
---|
[571] | 221 | end |
---|
| 222 | % MirrorPath=get(handles.MirrorDir,'String'); |
---|
[569] | 223 | ListExperiments=get(handles.ListExperiments,'String'); |
---|
| 224 | list_val=get(handles.ListExperiments,'Value'); |
---|
| 225 | if isequal(list_val(1),1) |
---|
| 226 | ListExperiments=ListExperiments(2:end); %choose all experiments |
---|
| 227 | testList=1; |
---|
| 228 | set(handles.ListExperiments,'Value',1) |
---|
| 229 | else |
---|
| 230 | ListExperiments=ListExperiments(list_val);%choose selected experiments |
---|
| 231 | testList=0; |
---|
| 232 | end |
---|
[589] | 233 | scan_experiments(handles,ListExperiments,CampaignPath,MirrorPath) |
---|
[571] | 234 | |
---|
| 235 | |
---|
| 236 | %------------------------------------------------------------------------ |
---|
| 237 | % --- Executes on selection change in ListExperiments. |
---|
| 238 | function scan_experiments(handles,ListExperiments,CampaignPath,MirrorPath) |
---|
| 239 | %------------------------------------------------------------------------ |
---|
| 240 | ListDevices={}; |
---|
[569] | 241 | for iexp=1:numel(ListExperiments) |
---|
[571] | 242 | hdir=dir(fullfile(CampaignPath,ListExperiments{iexp})); %list files and dir in the experiment directory |
---|
[569] | 243 | idir=0; |
---|
| 244 | for ilist=1:length(hdir) |
---|
[570] | 245 | if ~isequal(hdir(ilist).name(1),'.') |
---|
[571] | 246 | DataSeries=fullfile(CampaignPath,ListExperiments{iexp},hdir(ilist).name); |
---|
[589] | 247 | if ~isempty(MirrorPath) |
---|
[570] | 248 | mirror=fullfile(MirrorPath,ListExperiments{iexp},hdir(ilist).name); |
---|
[571] | 249 | if ~exist(mirror)% create mirror if needed |
---|
[589] | 250 | system(['ln -s ' DataSeries ' ' mirror]) |
---|
[570] | 251 | end |
---|
| 252 | end |
---|
| 253 | check_list=strcmp(hdir(ilist).name,ListDevices); |
---|
[571] | 254 | if isempty(find(check_list, 1)) |
---|
[570] | 255 | ListDevices=[ListDevices;hdir(ilist).name]; |
---|
| 256 | end |
---|
[569] | 257 | end |
---|
| 258 | end |
---|
| 259 | end |
---|
| 260 | set(handles.ListDevices,'String',ListDevices) |
---|
| 261 | |
---|
| 262 | %------------------------------------------------------------------------ |
---|
| 263 | % --- Executes on button press in update_headings. |
---|
| 264 | function ListDevices_Callback(hObject, eventdata, handles) |
---|
| 265 | % CurrentPath=get(handles.SourceDir,'String'); |
---|
| 266 | % ListExperiments=get(handles.ListExperiments,'String'); |
---|
| 267 | % list_val=get(handles.ListExperiments,'Value'); |
---|
| 268 | % if isequal(list_val,1) |
---|
| 269 | % ListExperiments=ListExperiments(2:end); |
---|
| 270 | % else |
---|
| 271 | % ListExperiments=ListExperiments(list_val); |
---|
| 272 | % end |
---|
| 273 | % set(handles.ListRecords,'Value',1) |
---|
| 274 | % set(handles.ListXml,'Value',1) |
---|
| 275 | % ListDevices=get(handles.ListDevices,'String'); |
---|
| 276 | % list_val=get(handles.ListDevices,'Value'); |
---|
| 277 | % if isequal(list_val,1) |
---|
| 278 | % ListDevices=ListDevices(2:end); |
---|
| 279 | % else |
---|
| 280 | % ListDevices=ListDevices(list_val); |
---|
| 281 | % end |
---|
| 282 | % [ListDevices,ListRecords,ListXml]=ListDir(CurrentPath,ListExperiments,ListDevices,{}); |
---|
| 283 | % set(handles.ListRecords,'String',[{'*'};ListRecords']) |
---|
| 284 | % set(handles.ListXml,'String',[{'*'};ListXml']) |
---|
| 285 | % |
---|
| 286 | % |
---|
| 287 | % if strcmp(get(handles.MirrorDir,'Visible'),'on') |
---|
| 288 | % CurrentPath=get(handles.MirrorDir,'String'); |
---|
| 289 | % else |
---|
| 290 | % CurrentPath=get(handles.SourceDir,'String'); |
---|
| 291 | % end |
---|
| 292 | % ListDevices=get(handles.ListDevices,'String'); |
---|
| 293 | % Device=ListDevices(get(handles.ListDevices,'Value')); |
---|
| 294 | % % else |
---|
| 295 | % hdir=dir(fullfile(SourcePath,Device)); %list files and dirs |
---|
| 296 | |
---|
| 297 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
| 298 | |
---|
| 299 | |
---|
| 300 | |
---|
| 301 | %------------------------------------------------------------------------ |
---|
| 302 | % --- Executes on selection change in ListRecords. |
---|
| 303 | function ListRecords_Callback(hObject, eventdata, handles) |
---|
| 304 | Value=get(handles.ListRecords,'Value'); |
---|
| 305 | if isequal(Value(1),1) |
---|
| 306 | set(handles.ListRecords,'Value',1); |
---|
| 307 | end |
---|
| 308 | |
---|
| 309 | %------------------------------------------------------------------------ |
---|
| 310 | % --- Executes on button press in CampaignDoc. |
---|
| 311 | function CampaignDoc_Callback(hObject, eventdata, handles) |
---|
| 312 | %------------------------------------------------------------------------ |
---|
| 313 | answer=msgbox_uvmat('INPUT_Y-N','This function will update the global xml rpresentation of the data set and the Heading of each xml file') |
---|
| 314 | if ~isequal(answer{1},'OK') |
---|
| 315 | return |
---|
| 316 | end |
---|
| 317 | set(handles.ListExperiments,'Value',1) |
---|
| 318 | ListExperiments_Callback(hObject, eventdata, handles)%update the overview of the experiment directories |
---|
[581] | 319 | DataviewData=get(handles.browse_data,'UserData'); |
---|
[569] | 320 | List=DataviewData.List; |
---|
| 321 | Currentpath=get(handles.SourceDir,'String'); |
---|
| 322 | [Currentpath,Campaign,DirExt]=fileparts(Currentpath); |
---|
| 323 | Campaign=[Campaign DirExt]; |
---|
| 324 | t=xmltree; |
---|
| 325 | t=set(t,1,'name','CampaignDoc'); |
---|
| 326 | t = attributes(t,'add',1,'source','directory'); |
---|
| 327 | SubCampaignTest=get(handles.SubCampaignTest,'Value'); |
---|
| 328 | root_uid=1; |
---|
| 329 | if SubCampaignTest |
---|
| 330 | %TO DO open an exoiting xml doc |
---|
| 331 | [t,root_uid]=add(t,1,'element','SubCampaign'); |
---|
| 332 | t =attributes(t,'add',root_uid,'DirName',Campaign); |
---|
| 333 | end |
---|
| 334 | for iexp=1:length(List.Experiment) |
---|
| 335 | set(handles.ListExperiments,'Value',iexp+1) |
---|
| 336 | drawnow |
---|
| 337 | test_mod=0; |
---|
| 338 | [t,uid_exp]=add(t,root_uid,'element','Experiment'); |
---|
| 339 | t = attributes(t,'add',uid_exp,'i',num2str(iexp)); |
---|
| 340 | ExpName=List.Experiment{iexp}.name; |
---|
| 341 | t = attributes(t,'add',uid_exp,'DirName',List.Experiment{iexp}.name); |
---|
| 342 | |
---|
| 343 | if isfield(List.Experiment{iexp},'Device') |
---|
| 344 | for idevice=1:length(List.Experiment{iexp}.Device) |
---|
| 345 | [t,uid_device]=add(t,uid_exp,'element','Device'); |
---|
| 346 | DeviceName=List.Experiment{iexp}.Device{idevice}.name; |
---|
| 347 | t = attributes(t,'add',uid_device,'DirName',List.Experiment{iexp}.Device{idevice}.name); |
---|
| 348 | if isfield(List.Experiment{iexp}.Device{idevice},'xmlfile') |
---|
| 349 | for ixml=1:length(List.Experiment{iexp}.Device{idevice}.xmlfile) |
---|
| 350 | FileName=List.Experiment{iexp}.Device{idevice}.xmlfile{ixml}; |
---|
| 351 | [Title,test]=check_heading(Currentpath,Campaign,ExpName,DeviceName,[],FileName,SubCampaignTest); |
---|
| 352 | if test |
---|
| 353 | [List.Experiment{iexp}.Device{idevice}.xmlfile{ixml} ' , Heading updated'] |
---|
| 354 | end |
---|
| 355 | if isequal(Title,'ImaDoc') |
---|
| 356 | [t,uid_xml]=add(t,uid_device,'element','ImaDoc'); |
---|
| 357 | t = attributes(t,'add',uid_xml,'source','file'); |
---|
| 358 | [t]=add(t,uid_xml,'chardata',List.Experiment{iexp}.Device{idevice}.xmlfile{ixml}); |
---|
| 359 | end |
---|
| 360 | end |
---|
| 361 | elseif isfield(List.Experiment{iexp}.Device{idevice},'Record') |
---|
| 362 | for irecord=1:length(List.Experiment{iexp}.Device{idevice}.Record) |
---|
| 363 | RecordName=List.Experiment{iexp}.Device{idevice}.Record{irecord}.name; |
---|
| 364 | [t,uid_record]=add(t,uid_device,'element','Record'); |
---|
| 365 | t = attributes(t,'add',uid_record,'DirName',RecordName); |
---|
| 366 | if isfield(List.Experiment{iexp}.Device{idevice}.Record{irecord},'xmlfile') |
---|
| 367 | for ixml=1:length(List.Experiment{iexp}.Device{idevice}.Record{irecord}.xmlfile) |
---|
| 368 | FileName=List.Experiment{iexp}.Device{idevice}.Record{irecord}.xmlfile{ixml}; |
---|
| 369 | [Title,test]=check_heading(Currentpath,Campaign,ExpName,DeviceName,RecordName,FileName,SubCampaignTest); |
---|
| 370 | if test |
---|
| 371 | [FileName ' , Heading updated'] |
---|
| 372 | end |
---|
| 373 | [t,uid_xml]=add(t,uid_record,'element','ImaDoc'); |
---|
| 374 | t = attributes(t,'add',uid_xml,'source','file'); |
---|
| 375 | [t]=add(t,uid_xml,'chardata',FileName); |
---|
| 376 | end |
---|
| 377 | end |
---|
| 378 | end |
---|
| 379 | end |
---|
| 380 | end |
---|
| 381 | end |
---|
| 382 | end |
---|
| 383 | set(handles.ListExperiments,'Value',1) |
---|
| 384 | outputdir=get(handles.SourceDir,'String'); |
---|
| 385 | [path,dirname]=fileparts(outputdir); |
---|
| 386 | outputfile=fullfile(outputdir,[dirname '.xml']); |
---|
| 387 | %campaigndoc(t); |
---|
| 388 | save(t,outputfile) |
---|
| 389 | |
---|
| 390 | %------------------------------------------------------------------------ |
---|
| 391 | % --- Executes on button press in CampaignDoc. |
---|
| 392 | function edit_xml_Callback(hObject, eventdata, handles) |
---|
| 393 | %------------------------------------------------------------------------ |
---|
| 394 | CurrentPath=get(handles.SourceDir,'String'); |
---|
| 395 | %[CurrentPath,Name,Ext]=fileparts(CurrentDir); |
---|
| 396 | ListExperiments=get(handles.ListExperiments,'String'); |
---|
| 397 | Value=get(handles.ListExperiments,'Value'); |
---|
| 398 | if ~isequal(Value,1) |
---|
| 399 | ListExperiments=ListExperiments(Value); |
---|
| 400 | end |
---|
| 401 | ListDevices=get(handles.ListDevices,'String'); |
---|
| 402 | Value=get(handles.ListDevices,'Value'); |
---|
| 403 | if ~isequal(Value,1) |
---|
| 404 | ListDevices=ListDevices(Value); |
---|
| 405 | end |
---|
| 406 | ListRecords=get(handles.ListRecords,'String'); |
---|
| 407 | Value=get(handles.ListRecords,'Value'); |
---|
| 408 | if ~isequal(Value,1) |
---|
| 409 | ListRecords=ListRecords(Value); |
---|
| 410 | end |
---|
| 411 | [ListDevices,ListRecords,ListXml,List]=ListDir(CurrentPath,ListExperiments,ListDevices,ListRecords); |
---|
| 412 | ListXml=get(handles.ListXml,'String'); |
---|
| 413 | Value=get(handles.ListXml,'Value'); |
---|
| 414 | set(handles.ListXml,'Value',Value(1)); |
---|
| 415 | if isequal(Value(1),1) |
---|
| 416 | msgbox_uvmat('ERROR','an xml file needs to be selected') |
---|
| 417 | return |
---|
| 418 | else |
---|
| 419 | XmlName=ListXml{Value(1)}; |
---|
| 420 | end |
---|
| 421 | for iexp=1:length(List.Experiment) |
---|
| 422 | ExpName=List.Experiment{iexp}.name; |
---|
| 423 | if isfield(List.Experiment{iexp},'Device') |
---|
| 424 | for idevice=1:length(List.Experiment{iexp}.Device) |
---|
| 425 | DeviceName=List.Experiment{iexp}.Device{idevice}.name; |
---|
| 426 | if isfield(List.Experiment{iexp}.Device{idevice},'xmlfile') |
---|
| 427 | for ixml=1:length(List.Experiment{iexp}.Device{idevice}.xmlfile) |
---|
| 428 | FileName=List.Experiment{iexp}.Device{idevice}.xmlfile{ixml} |
---|
| 429 | if isequal(FileName,XmlName) |
---|
| 430 | editxml(fullfile(CurrentPath,ExpName,DeviceName,FileName)); |
---|
| 431 | return |
---|
| 432 | end |
---|
| 433 | end |
---|
| 434 | elseif isfield(List.Experiment{iexp}.Device{idevice},'Record') |
---|
| 435 | for irecord=1:length(List.Experiment{iexp}.Device{idevice}.Record) |
---|
| 436 | RecordName=List.Experiment{iexp}.Device{idevice}.Record{irecord}.name; |
---|
| 437 | if isfield(List.Experiment{iexp}.Device{idevice}.Record{irecord},'xmlfile') |
---|
| 438 | for ixml=1:length(List.Experiment{iexp}.Device{idevice}.Record{irecord}.xmlfile) |
---|
| 439 | FileName=List.Experiment{iexp}.Device{idevice}.Record{irecord}.xmlfile{ixml}; |
---|
| 440 | if isequal(FileName,XmlName) |
---|
| 441 | editxml(fullfile(CurrentPath,ExpName,DeviceName,RecordName,FileName)); |
---|
| 442 | return |
---|
| 443 | end |
---|
| 444 | end |
---|
| 445 | end |
---|
| 446 | end |
---|
| 447 | end |
---|
| 448 | end |
---|
| 449 | end |
---|
| 450 | end |
---|
| 451 | |
---|
| 452 | |
---|
| 453 | |
---|
| 454 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
| 455 | % CurrentPath/Campaign: root directory |
---|
| 456 | function [Title,test_mod]=check_heading(Currentpath,Campaign,Experiment,Device,Record,xmlname,testSubCampaign) |
---|
| 457 | |
---|
| 458 | %Shema for Heading: |
---|
| 459 | % Campaign |
---|
| 460 | % (SubCampaign) |
---|
| 461 | % Experiment |
---|
| 462 | % Device |
---|
| 463 | % (Record) |
---|
| 464 | % ImageName |
---|
| 465 | % DateExp |
---|
| 466 | % old: %Project: suppressed ( changed to Campaign) |
---|
| 467 | %Exp: suppressed (changed to experiment) |
---|
| 468 | %ImaNames: changed to ImageName |
---|
| 469 | if exist('Record','var') && ~isempty(Record) |
---|
| 470 | xmlfullname=fullfile(Currentpath,Campaign,Experiment,Device,Record,xmlname); |
---|
| 471 | testrecord=1; |
---|
| 472 | else |
---|
| 473 | xmlfullname=fullfile(Currentpath,Campaign,Experiment,Device,xmlname); |
---|
| 474 | testrecord=0; |
---|
| 475 | end |
---|
| 476 | if ~exist('testSubCampaign','var') |
---|
| 477 | testSubCampaign=0; |
---|
| 478 | end |
---|
| 479 | if testSubCampaign |
---|
| 480 | SubCampaign=Campaign; |
---|
| 481 | [Currentpath,Campaign,DirExt]=fileparts(Currentpath); |
---|
| 482 | Campaign=[Campaign DirExt]; |
---|
| 483 | end |
---|
| 484 | test_mod=0; %test for the modification of the xml file |
---|
| 485 | t_device=xmltree(xmlfullname); |
---|
| 486 | Title=get(t_device,1,'name'); |
---|
| 487 | uid_child=children(t_device,1); |
---|
| 488 | Heading_old=[]; |
---|
| 489 | uidheading=0; |
---|
| 490 | for ilist=1:length(uid_child) |
---|
| 491 | name=get(t_device,uid_child(ilist),'name'); |
---|
| 492 | if isequal(name,'Heading') |
---|
| 493 | uidheading=uid_child(ilist); |
---|
| 494 | end |
---|
| 495 | end |
---|
| 496 | if uidheading |
---|
| 497 | subt=branch(t_device,uidheading); |
---|
| 498 | Heading_old=convert(subt); |
---|
| 499 | else |
---|
| 500 | return % do not edit xml files without element 'Heading' |
---|
| 501 | end |
---|
| 502 | if ~(isfield(Heading_old,'Campaign')&& isequal(Heading_old.Campaign,Campaign)) |
---|
| 503 | test_mod=1; |
---|
| 504 | end |
---|
| 505 | Heading.Campaign=Campaign; |
---|
| 506 | if testSubCampaign |
---|
| 507 | if ~(isfield(Heading_old,'SubCampaign')&& isequal(Heading_old.SubCampaign,SubCampaign)) |
---|
| 508 | test_mod=1; |
---|
| 509 | end |
---|
| 510 | Heading.SubCampaign=SubCampaign; |
---|
| 511 | end |
---|
| 512 | if ~(isfield(Heading_old,'Experiment')&& isequal(Heading_old.Experiment,Experiment)) |
---|
| 513 | test_mod=1; |
---|
| 514 | end |
---|
| 515 | Heading.Experiment=Experiment; |
---|
| 516 | if ~(isfield(Heading_old,'Device')&& isequal(Heading_old.Device,Device)) |
---|
| 517 | test_mod=1; |
---|
| 518 | end |
---|
| 519 | Heading.Device=Device; |
---|
| 520 | if testrecord |
---|
| 521 | if ~(isfield(Heading_old,'Record')&& isequal(Heading_old.Record,Record)) |
---|
| 522 | test_mod=1; |
---|
| 523 | end |
---|
| 524 | Heading.Record=Record; |
---|
| 525 | end |
---|
| 526 | if isfield(Heading_old,'ImaNames') |
---|
| 527 | test_mod=1; |
---|
| 528 | if ~isempty(Heading_old.ImaNames) |
---|
| 529 | Heading.ImageName=Heading_old.ImaNames; |
---|
| 530 | end |
---|
| 531 | end |
---|
| 532 | if isfield(Heading_old,'ImageName')&& ~isempty(Heading_old.ImageName) |
---|
| 533 | Heading.ImageName=Heading_old.ImageName; |
---|
| 534 | end |
---|
| 535 | if isfield(Heading_old,'DateExp')&& ~isempty(Heading_old.DateExp) |
---|
| 536 | Heading.DateExp=Heading_old.DateExp; |
---|
| 537 | end |
---|
| 538 | if test_mod && uidheading |
---|
| 539 | uid_child=children(t_device,uidheading); |
---|
| 540 | t_device=delete(t_device,uid_child); |
---|
| 541 | t_device=struct2xml(Heading,t_device,uidheading); |
---|
| 542 | backupfile=xmlfullname; |
---|
| 543 | testexist=2; |
---|
| 544 | while testexist==2 |
---|
| 545 | backupfile=[backupfile '~']; |
---|
| 546 | testexist=exist(backupfile,'file'); |
---|
| 547 | end |
---|
| 548 | [success,message]=copyfile(xmlfullname,backupfile);%make backup |
---|
| 549 | if isequal(success,1) |
---|
| 550 | delete(xmlfullname) |
---|
| 551 | else |
---|
| 552 | return |
---|
| 553 | end |
---|
| 554 | save(t_device,xmlfullname) |
---|
| 555 | end |
---|
| 556 | |
---|
| 557 | %------------------------------------------------------------------------ |
---|
| 558 | % --- Executes on button press in HELP. |
---|
| 559 | function HELP_Callback(hObject, eventdata, handles) |
---|
| 560 | path_to_uvmat=which ('uvmat')% check the path of uvmat |
---|
| 561 | pathelp=fileparts(path_to_uvmat); |
---|
| 562 | helpfile=fullfile(pathelp,'UVMAT_DOC','uvmat_doc.html'); |
---|
| 563 | if isempty(dir(helpfile)), msgbox_uvmat('ERROR','Please put the help file uvmat_doc.html in the directory UVMAT/UVMAT_DOC') |
---|
| 564 | else |
---|
| 565 | web([helpfile '#dataview']) |
---|
| 566 | end |
---|
| 567 | |
---|
| 568 | |
---|
| 569 | |
---|
| 570 | % --- Executes on selection change in ListXml. |
---|
| 571 | function ListXml_Callback(hObject, eventdata, handles) |
---|
| 572 | Value=get(handles.ListXml,'Value'); |
---|
| 573 | if isequal(Value(1),1) |
---|
| 574 | set(handles.ListXml,'Value',1); |
---|
| 575 | end |
---|
| 576 | |
---|
| 577 | |
---|
| 578 | % --- Executes on button press in clean_civ_cmx. |
---|
| 579 | function clean_civ_cmx_Callback(hObject, eventdata, handles) |
---|
| 580 | message='this function will delete all files with extensions .log, .bat, .cmx,.cmx2,.errors in the input directory(ies)'; |
---|
| 581 | answer=msgbox_uvmat('INPUT_Y-N',message); |
---|
| 582 | if ~isequal(answer,'Yes') |
---|
| 583 | return |
---|
| 584 | end |
---|
| 585 | set(handles.ListExperiments,'Value',1) |
---|
| 586 | ListExperiments_Callback(hObject, eventdata, handles)%update the overview of the experiment directories |
---|
[581] | 587 | DataviewData=get(handles.browse_data,'UserData') |
---|
[569] | 588 | List=DataviewData.List; |
---|
| 589 | Currentpath=get(handles.SourceDir,'String'); |
---|
| 590 | [Currentpath,Campaign,DirExt]=fileparts(Currentpath); |
---|
| 591 | Campaign=[Campaign DirExt]; |
---|
| 592 | SubCampaignTest=get(handles.SubCampaignTest,'Value'); |
---|
| 593 | nbdelete_tot=0; |
---|
| 594 | for iexp=1:length(List.Experiment) |
---|
| 595 | set(handles.ListExperiments,'Value',iexp+1) |
---|
| 596 | drawnow |
---|
| 597 | test_mod=0; |
---|
| 598 | ExpName=List.Experiment{iexp}.name; |
---|
| 599 | nbdelete=0; |
---|
| 600 | if isfield(List.Experiment{iexp},'Device') |
---|
| 601 | for idevice=1:length(List.Experiment{iexp}.Device) |
---|
| 602 | DeviceName=List.Experiment{iexp}.Device{idevice}.name; |
---|
| 603 | if isfield(List.Experiment{iexp}.Device{idevice},'xmlfile') |
---|
| 604 | currentdir=fullfile(Currentpath,Campaign,ExpName,DeviceName); |
---|
| 605 | hdir=dir(currentdir); %list files and dirs |
---|
| 606 | idir=0; |
---|
| 607 | for ilist=1:length(hdir) |
---|
| 608 | if hdir(ilist).isdir |
---|
| 609 | dirname=hdir(ilist).name; |
---|
| 610 | if ~isequal(dirname(1),'.')&&~isequal(dirname(1),'0') |
---|
| 611 | CivDir=fullfile(currentdir,dirname) |
---|
| 612 | hCivDir=dir(CivDir); |
---|
| 613 | for ilist=1:length(hCivDir) |
---|
| 614 | FileName=hCivDir(ilist).name; |
---|
| 615 | [dd,ff,Ext]=fileparts(FileName); |
---|
| 616 | if isequal(Ext,'.log')||isequal(Ext,'.bat')||isequal(Ext,'.cmx')||isequal(Ext,'.cmx2')|| isequal(Ext,'.errors') |
---|
| 617 | delete(fullfile(CivDir,FileName)) |
---|
| 618 | nbdelete=nbdelete+1; |
---|
| 619 | end |
---|
| 620 | end |
---|
| 621 | end |
---|
| 622 | end |
---|
| 623 | end |
---|
| 624 | elseif isfield(List.Experiment{iexp}.Device{idevice},'Record') |
---|
| 625 | for irecord=1:length(List.Experiment{iexp}.Device{idevice}.Record) |
---|
| 626 | RecordName=List.Experiment{iexp}.Device{idevice}.Record{irecord}.name; |
---|
| 627 | if isfield(List.Experiment{iexp}.Device{idevice}.Record{irecord},'xmlfile') |
---|
| 628 | 'look at subdirectories' |
---|
| 629 | end |
---|
| 630 | end |
---|
| 631 | end |
---|
| 632 | end |
---|
| 633 | end |
---|
| 634 | display([num2str(nbdelete) ' files deleted']) |
---|
| 635 | nbdelete_tot=nbdelete_tot+nbdelete; |
---|
| 636 | end |
---|
| 637 | msgbox_uvmat('CONFIRMATION',['END: ' num2str(nbdelete_tot) ' files deleted by clean_civ_cmx']) |
---|
| 638 | set(handles.ListExperiments,'Value',1) |
---|
| 639 | |
---|
| 640 | |
---|
| 641 | % --- Executes on button press in OK. |
---|
| 642 | function OK_Callback(hObject, eventdata, handles) |
---|
| 643 | %------------------------------------------------------------------------ |
---|
| 644 | if strcmp(get(handles.MirrorDir,'Visible'),'on') |
---|
| 645 | Campaign=get(handles.MirrorDir,'String'); |
---|
| 646 | else |
---|
| 647 | Campaign=get(handles.SourceDir,'String'); |
---|
| 648 | end |
---|
| 649 | handles.output.Campaign=Campaign; |
---|
| 650 | Experiment=get(handles.ListExperiments,'String'); |
---|
| 651 | IndicesExp=get(handles.ListExperiments,'Value'); |
---|
| 652 | if ~isequal(IndicesExp,1)% if first element ('*') selected all the experiments are selected |
---|
| 653 | Experiment=Experiment(IndicesExp);% use the selection of the list of experiments |
---|
| 654 | end |
---|
| 655 | Device=get(handles.ListDevices,'String'); |
---|
| 656 | Value=get(handles.ListDevices,'Value'); |
---|
| 657 | Device=Device(Value); |
---|
| 658 | handles.output.Experiment=Experiment; |
---|
| 659 | handles.output.Device=Device; |
---|
| 660 | guidata(hObject, handles);% Update handles structure |
---|
[581] | 661 | uiresume(handles.browse_data); |
---|
[569] | 662 | drawnow |
---|
| 663 | return |
---|
| 664 | |
---|
| 665 | |
---|
| 666 | % ListRecords=get(handles.ListRecords,'String'); |
---|
| 667 | % Value=get(handles.ListRecords,'Value'); |
---|
| 668 | % if ~isequal(Value,1) |
---|
| 669 | % ListRecords=ListRecords(Value); |
---|
| 670 | % end |
---|
| 671 | |
---|
| 672 | %[ListDevices,ListRecords,ListXml,List]=ListDir(CurrentPath,ListExperiments,ListDevices); |
---|
| 673 | ListXml=get(handles.ListXml,'String'); |
---|
| 674 | Value=get(handles.ListXml,'Value'); |
---|
| 675 | if isequal(Value,1) |
---|
| 676 | msgbox_uvmat('ERROR','you need to select in the GUI browse_data the xml files to edit') |
---|
| 677 | return |
---|
| 678 | else |
---|
| 679 | ListXml=ListXml(Value); |
---|
| 680 | end |
---|
| 681 | |
---|
| 682 | %update all the selected xml files |
---|
[581] | 683 | DataviewData=get(handles.browse_data,'UserData'); |
---|
[569] | 684 | % answer=msgbox_uvmat('INPUT_Y-N',[num2str(length(Value)) ' xml files for device ' ListDevices{1} ' will be refreshed with ' ... |
---|
| 685 | % DataviewData.GeometryCalib.CalibrationType ' calibration data']) |
---|
| 686 | % if ~isequal(answer,'Yes') |
---|
| 687 | % return |
---|
| 688 | % end |
---|
| 689 | %List.Experiment{1}.Device{1} |
---|
| 690 | %List.Experiment{2}.Device{1} |
---|
| 691 | for iexp=1:length(List.Experiment) |
---|
| 692 | ExpName=List.Experiment{iexp}.name; |
---|
| 693 | set(handles.ListExperiments,'Value',IndicesExp(iexp)); |
---|
| 694 | if isfield(List.Experiment{iexp},'Device') |
---|
| 695 | for idevice=1:length(List.Experiment{iexp}.Device) |
---|
| 696 | DeviceName=List.Experiment{iexp}.Device{idevice}.name; |
---|
| 697 | if isfield(List.Experiment{iexp}.Device{idevice},'xmlfile') |
---|
| 698 | for ixml=1:length(List.Experiment{iexp}.Device{idevice}.xmlfile) |
---|
| 699 | FileName=List.Experiment{iexp}.Device{idevice}.xmlfile{ixml}; |
---|
| 700 | for ilistxml=1:length(ListXml) |
---|
| 701 | if isequal(FileName,ListXml{ilistxml}) |
---|
| 702 | set(handles.ListXml,'Value',Value(ilistxml)) |
---|
| 703 | drawnow |
---|
| 704 | xmlfullname=fullfile(CurrentPath,ExpName,DeviceName,FileName); |
---|
| 705 | update_imadoc(DataviewData.GeometryCalib,xmlfullname) |
---|
| 706 | display([xmlfullname ' updated']) |
---|
| 707 | break |
---|
| 708 | end |
---|
| 709 | end |
---|
| 710 | end |
---|
| 711 | elseif isfield(List.Experiment{iexp}.Device{idevice},'Record') |
---|
| 712 | for irecord=1:length(List.Experiment{iexp}.Device{idevice}.Record) |
---|
| 713 | RecordName=List.Experiment{iexp}.Device{idevice}.Record{irecord}.name; |
---|
| 714 | if isfield(List.Experiment{iexp}.Device{idevice}.Record{irecord},'xmlfile') |
---|
| 715 | for ixml=1:length(List.Experiment{iexp}.Device{idevice}.Record{irecord}.xmlfile) |
---|
| 716 | FileName=List.Experiment{iexp}.Device{idevice}.Record{irecord}.xmlfile{ixml}; |
---|
| 717 | for ilistxml=1:length(ListXml) |
---|
| 718 | if isequal(FileName,ListXml{ilistxml}) |
---|
| 719 | set(handles.ListXml,'Value',Value(ilistxml)) |
---|
| 720 | drawnow |
---|
| 721 | xmlfullname=fullfile(CurrentPath,ExpName,DeviceName,RecordName,FileName); |
---|
| 722 | update_imadoc(DataviewData.GeometryCalib,xmlfullname) |
---|
| 723 | display([xmlfullname ' updated']) |
---|
| 724 | break |
---|
| 725 | end |
---|
| 726 | end |
---|
| 727 | end |
---|
| 728 | end |
---|
| 729 | end |
---|
| 730 | end |
---|
| 731 | end |
---|
| 732 | end |
---|
| 733 | end |
---|
| 734 | set(handles.ListXml,'Value',Value) |
---|
| 735 | % |
---|
| 736 | % |
---|
| 737 | % |
---|
| 738 | % |
---|
| 739 | % |
---|
| 740 | % |
---|
| 741 | % |
---|
| 742 | % CurrentPath=get(handles.SourceDir,'String');%= get(hObject,'String'); |
---|
| 743 | % ListExperiments=get(handles.ListExperiments,'String'); |
---|
| 744 | % Value=get(handles.ListExperiments,'Value'); |
---|
| 745 | % if ~isequal(Value,1) |
---|
| 746 | % ListExperiments=ListExperiments(Value); |
---|
| 747 | % end |
---|
| 748 | % ListDevices=get(handles.ListDevices,'String'); |
---|
| 749 | % Value=get(handles.ListDevices,'Value'); |
---|
| 750 | % if isequal(Value,1) |
---|
| 751 | % msgbox_uvmat('ERROR','manually select in the GUI browse_data the device being calibrated') |
---|
| 752 | % return |
---|
| 753 | % else |
---|
| 754 | % ListDevices=ListDevices(Value); |
---|
| 755 | % end |
---|
| 756 | % ListRecords=get(handles.ListRecords,'String'); |
---|
| 757 | % Value=get(handles.ListRecords,'Value'); |
---|
| 758 | % if ~isequal(Value,1) |
---|
| 759 | % ListRecords=ListRecords(Value); |
---|
| 760 | % end |
---|
| 761 | % [ListDevices,ListRecords,ListXml,List]=ListDir(CurrentPath,ListExperiments,ListDevices,ListRecords); |
---|
| 762 | % ListXml=get(handles.ListXml,'String'); |
---|
| 763 | % Value=get(handles.ListXml,'Value'); |
---|
| 764 | % if isequal(Value,1) |
---|
| 765 | % msgbox_uvmat('ERROR','you need to select in the GUI browse_data the xml files to edit') |
---|
| 766 | % return |
---|
| 767 | % else |
---|
| 768 | % ListXml=ListXml(Value); |
---|
| 769 | % end |
---|
| 770 | % handles.output.CurrentPath=CurrentPath; |
---|
| 771 | % handles.output.ListExperiments=ListExperiments; |
---|
| 772 | % handles.output.ListDevices=ListDevices; |
---|
| 773 | % handles.output.ListRecords=ListRecords; |
---|
| 774 | % handles.output.ListXml=ListXml; |
---|
| 775 | % handles.output.List=List; |
---|
| 776 | % handles.output ='OK, Calibration replicated'; |
---|
| 777 | % guidata(hObject, handles);% Update handles structure |
---|
[581] | 778 | % uiresume(handles.browse_data); |
---|
[569] | 779 | |
---|
| 780 | % --- Executes on button press in Cancel. |
---|
| 781 | function Cancel_Callback(hObject, eventdata, handles) |
---|
| 782 | handles.output = get(hObject,'String'); |
---|
| 783 | guidata(hObject, handles); % Update handles structure |
---|
| 784 | % Use UIRESUME instead of delete because the OutputFcn needs |
---|
[581] | 785 | uiresume(handles.browse_data); |
---|
[569] | 786 | |
---|
[581] | 787 | % --- Executes when user attempts to close browse_data. |
---|
| 788 | function browse_data_CloseRequestFcn(hObject, eventdata, handles) |
---|
| 789 | if isequal(get(handles.browse_data, 'waitstatus'), 'waiting') |
---|
[569] | 790 | % The GUI is still in UIWAIT, us UIRESUME |
---|
[581] | 791 | uiresume(handles.browse_data); |
---|
[569] | 792 | else |
---|
| 793 | % The GUI is no longer waiting, just close it |
---|
[581] | 794 | delete(handles.browse_data); |
---|
[569] | 795 | end |
---|
| 796 | |
---|
| 797 | % --- Executes on key press over figure1 with no controls selected. |
---|
[581] | 798 | function browse_data_KeyPressFcn(hObject, eventdata, handles) |
---|
[569] | 799 | % Check for "enter" or "escape" |
---|
| 800 | if isequal(get(hObject,'CurrentKey'),'escape') |
---|
| 801 | % User said no by hitting escape |
---|
| 802 | handles.output = 'Cancel'; |
---|
| 803 | |
---|
| 804 | % Update handles structure |
---|
| 805 | guidata(hObject, handles); |
---|
| 806 | |
---|
[581] | 807 | uiresume(handles.browse_data); |
---|
[569] | 808 | end |
---|
| 809 | if isequal(get(hObject,'CurrentKey'),'return') |
---|
[581] | 810 | uiresume(handles.browse_data); |
---|
[569] | 811 | end |
---|