| 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 | |
|---|
| 24 | % Last Modified by GUIDE v2.5 07-Mar-2013 18:55:00 |
|---|
| 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. |
|---|
| 47 | function browse_data_OpeningFcn(hObject, eventdata, handles, Campaign) |
|---|
| 48 | %------------------------------------------------------------------------ |
|---|
| 49 | |
|---|
| 50 | %% Choose default command line output for browse_data |
|---|
| 51 | handles.output = 'Cancel'; |
|---|
| 52 | |
|---|
| 53 | %% Update handles structure |
|---|
| 54 | guidata(hObject, handles); |
|---|
| 55 | set(hObject,'WindowButtonDownFcn',{'mouse_down'}) % allows mouse action with right button (zoom for uicontrol display) |
|---|
| 56 | |
|---|
| 57 | %% Determine the position of the dialog - centered on the screen |
|---|
| 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); |
|---|
| 73 | % |
|---|
| 74 | % if exist('GeometryCalib','var') |
|---|
| 75 | % DataviewData.GeometryCalib=GeometryCalib; |
|---|
| 76 | % set(hObject,'UserData',DataviewData) |
|---|
| 77 | % end |
|---|
| 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 |
|---|
| 96 | scan_campaign(handles,Campaign) |
|---|
| 97 | set(handles.OK,'Visible','on') |
|---|
| 98 | set(handles.Cancel,'Visible','on') |
|---|
| 99 | set(handles.browse_data,'WindowStyle','modal')% Make the GUI modal |
|---|
| 100 | set(hObject,'Visible','on') |
|---|
| 101 | drawnow |
|---|
| 102 | % UIWAIT makes GUI wait for user response (see UIRESUME) |
|---|
| 103 | uiwait(handles.browse_data); |
|---|
| 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; |
|---|
| 112 | delete(handles.browse_data) |
|---|
| 113 | |
|---|
| 114 | %------------------------------------------------------------------------ |
|---|
| 115 | % --- Executes on button press in CreateMirror. |
|---|
| 116 | function CreateMirror_Callback(hObject, eventdata, handles) |
|---|
| 117 | %------------------------------------------------------------------------ |
|---|
| 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 |
|---|
| 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; |
|---|
| 151 | |
|---|
| 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 | |
|---|
| 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) |
|---|
| 179 | |
|---|
| 180 | |
|---|
| 181 | %------------------------------------------------------------------------ |
|---|
| 182 | function scan_campaign(handles,Campaign) |
|---|
| 183 | %------------------------------------------------------------------------ |
|---|
| 184 | %set(handles.SourceDir,'BackgroundColor',[1 1 0]) |
|---|
| 185 | drawnow |
|---|
| 186 | %SourceDir=get(handles.SourceDir,'String'); |
|---|
| 187 | %MirrorDir=get(handles.MirrorDir,'String'); |
|---|
| 188 | ExpName={''}; |
|---|
| 189 | if exist(Campaign,'dir') |
|---|
| 190 | hdir=dir(Campaign); %list files and dirs |
|---|
| 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) |
|---|
| 203 | ListExperiments_Callback([],[], handles) |
|---|
| 204 | else |
|---|
| 205 | msgbox_uvmat('ERROR',['The input ' Campaign ' is not a directory']) |
|---|
| 206 | end |
|---|
| 207 | %set(handles.SourceDir,'BackgroundColor',[1 1 1]) |
|---|
| 208 | |
|---|
| 209 | |
|---|
| 210 | %------------------------------------------------------------------------ |
|---|
| 211 | % --- Executes on selection change in ListExperiments. |
|---|
| 212 | function ListExperiments_Callback(hObject, eventdata, handles) |
|---|
| 213 | %------------------------------------------------------------------------ |
|---|
| 214 | if strcmp(get(handles.MirrorDir,'Visible'),'on') |
|---|
| 215 | CampaignPath=get(handles.MirrorDir,'String'); |
|---|
| 216 | else |
|---|
| 217 | CampaignPath=get(handles.SourceDir,'String'); |
|---|
| 218 | end |
|---|
| 219 | % MirrorPath=get(handles.MirrorDir,'String'); |
|---|
| 220 | ListExperiments=get(handles.ListExperiments,'String'); |
|---|
| 221 | list_val=get(handles.ListExperiments,'Value'); |
|---|
| 222 | if isequal(list_val(1),1) |
|---|
| 223 | ListExperiments=ListExperiments(2:end); %choose all experiments |
|---|
| 224 | testList=1; |
|---|
| 225 | set(handles.ListExperiments,'Value',1) |
|---|
| 226 | else |
|---|
| 227 | ListExperiments=ListExperiments(list_val);%choose selected experiments |
|---|
| 228 | testList=0; |
|---|
| 229 | end |
|---|
| 230 | scan_experiments(handles,ListExperiments,CampaignPath) |
|---|
| 231 | |
|---|
| 232 | |
|---|
| 233 | %------------------------------------------------------------------------ |
|---|
| 234 | % --- Executes on selection change in ListExperiments. |
|---|
| 235 | function scan_experiments(handles,ListExperiments,CampaignPath,MirrorPath) |
|---|
| 236 | %------------------------------------------------------------------------ |
|---|
| 237 | ListDevices={}; |
|---|
| 238 | for iexp=1:numel(ListExperiments) |
|---|
| 239 | hdir=dir(fullfile(CampaignPath,ListExperiments{iexp})); %list files and dir in the experiment directory |
|---|
| 240 | idir=0; |
|---|
| 241 | for ilist=1:length(hdir) |
|---|
| 242 | if ~isequal(hdir(ilist).name(1),'.') |
|---|
| 243 | DataSeries=fullfile(CampaignPath,ListExperiments{iexp},hdir(ilist).name); |
|---|
| 244 | if exist('MirrorPath','var') |
|---|
| 245 | mirror=fullfile(MirrorPath,ListExperiments{iexp},hdir(ilist).name); |
|---|
| 246 | if ~exist(mirror)% create mirror if needed |
|---|
| 247 | system(['ln -s ' source ' ' mirror]) |
|---|
| 248 | end |
|---|
| 249 | end |
|---|
| 250 | check_list=strcmp(hdir(ilist).name,ListDevices); |
|---|
| 251 | if isempty(find(check_list, 1)) |
|---|
| 252 | ListDevices=[ListDevices;hdir(ilist).name]; |
|---|
| 253 | end |
|---|
| 254 | end |
|---|
| 255 | end |
|---|
| 256 | end |
|---|
| 257 | set(handles.ListDevices,'String',ListDevices) |
|---|
| 258 | |
|---|
| 259 | %------------------------------------------------------------------------ |
|---|
| 260 | % --- Executes on button press in update_headings. |
|---|
| 261 | function ListDevices_Callback(hObject, eventdata, handles) |
|---|
| 262 | % CurrentPath=get(handles.SourceDir,'String'); |
|---|
| 263 | % ListExperiments=get(handles.ListExperiments,'String'); |
|---|
| 264 | % list_val=get(handles.ListExperiments,'Value'); |
|---|
| 265 | % if isequal(list_val,1) |
|---|
| 266 | % ListExperiments=ListExperiments(2:end); |
|---|
| 267 | % else |
|---|
| 268 | % ListExperiments=ListExperiments(list_val); |
|---|
| 269 | % end |
|---|
| 270 | % set(handles.ListRecords,'Value',1) |
|---|
| 271 | % set(handles.ListXml,'Value',1) |
|---|
| 272 | % ListDevices=get(handles.ListDevices,'String'); |
|---|
| 273 | % list_val=get(handles.ListDevices,'Value'); |
|---|
| 274 | % if isequal(list_val,1) |
|---|
| 275 | % ListDevices=ListDevices(2:end); |
|---|
| 276 | % else |
|---|
| 277 | % ListDevices=ListDevices(list_val); |
|---|
| 278 | % end |
|---|
| 279 | % [ListDevices,ListRecords,ListXml]=ListDir(CurrentPath,ListExperiments,ListDevices,{}); |
|---|
| 280 | % set(handles.ListRecords,'String',[{'*'};ListRecords']) |
|---|
| 281 | % set(handles.ListXml,'String',[{'*'};ListXml']) |
|---|
| 282 | % |
|---|
| 283 | % |
|---|
| 284 | % if strcmp(get(handles.MirrorDir,'Visible'),'on') |
|---|
| 285 | % CurrentPath=get(handles.MirrorDir,'String'); |
|---|
| 286 | % else |
|---|
| 287 | % CurrentPath=get(handles.SourceDir,'String'); |
|---|
| 288 | % end |
|---|
| 289 | % ListDevices=get(handles.ListDevices,'String'); |
|---|
| 290 | % Device=ListDevices(get(handles.ListDevices,'Value')); |
|---|
| 291 | % % else |
|---|
| 292 | % hdir=dir(fullfile(SourcePath,Device)); %list files and dirs |
|---|
| 293 | |
|---|
| 294 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 295 | |
|---|
| 296 | |
|---|
| 297 | |
|---|
| 298 | %------------------------------------------------------------------------ |
|---|
| 299 | % --- Executes on selection change in ListRecords. |
|---|
| 300 | function ListRecords_Callback(hObject, eventdata, handles) |
|---|
| 301 | Value=get(handles.ListRecords,'Value'); |
|---|
| 302 | if isequal(Value(1),1) |
|---|
| 303 | set(handles.ListRecords,'Value',1); |
|---|
| 304 | end |
|---|
| 305 | |
|---|
| 306 | %------------------------------------------------------------------------ |
|---|
| 307 | % --- Executes on button press in CampaignDoc. |
|---|
| 308 | function CampaignDoc_Callback(hObject, eventdata, handles) |
|---|
| 309 | %------------------------------------------------------------------------ |
|---|
| 310 | 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') |
|---|
| 311 | if ~isequal(answer{1},'OK') |
|---|
| 312 | return |
|---|
| 313 | end |
|---|
| 314 | set(handles.ListExperiments,'Value',1) |
|---|
| 315 | ListExperiments_Callback(hObject, eventdata, handles)%update the overview of the experiment directories |
|---|
| 316 | DataviewData=get(handles.browse_data,'UserData'); |
|---|
| 317 | List=DataviewData.List; |
|---|
| 318 | Currentpath=get(handles.SourceDir,'String'); |
|---|
| 319 | [Currentpath,Campaign,DirExt]=fileparts(Currentpath); |
|---|
| 320 | Campaign=[Campaign DirExt]; |
|---|
| 321 | t=xmltree; |
|---|
| 322 | t=set(t,1,'name','CampaignDoc'); |
|---|
| 323 | t = attributes(t,'add',1,'source','directory'); |
|---|
| 324 | SubCampaignTest=get(handles.SubCampaignTest,'Value'); |
|---|
| 325 | root_uid=1; |
|---|
| 326 | if SubCampaignTest |
|---|
| 327 | %TO DO open an exoiting xml doc |
|---|
| 328 | [t,root_uid]=add(t,1,'element','SubCampaign'); |
|---|
| 329 | t =attributes(t,'add',root_uid,'DirName',Campaign); |
|---|
| 330 | end |
|---|
| 331 | for iexp=1:length(List.Experiment) |
|---|
| 332 | set(handles.ListExperiments,'Value',iexp+1) |
|---|
| 333 | drawnow |
|---|
| 334 | test_mod=0; |
|---|
| 335 | [t,uid_exp]=add(t,root_uid,'element','Experiment'); |
|---|
| 336 | t = attributes(t,'add',uid_exp,'i',num2str(iexp)); |
|---|
| 337 | ExpName=List.Experiment{iexp}.name; |
|---|
| 338 | t = attributes(t,'add',uid_exp,'DirName',List.Experiment{iexp}.name); |
|---|
| 339 | |
|---|
| 340 | if isfield(List.Experiment{iexp},'Device') |
|---|
| 341 | for idevice=1:length(List.Experiment{iexp}.Device) |
|---|
| 342 | [t,uid_device]=add(t,uid_exp,'element','Device'); |
|---|
| 343 | DeviceName=List.Experiment{iexp}.Device{idevice}.name; |
|---|
| 344 | t = attributes(t,'add',uid_device,'DirName',List.Experiment{iexp}.Device{idevice}.name); |
|---|
| 345 | if isfield(List.Experiment{iexp}.Device{idevice},'xmlfile') |
|---|
| 346 | for ixml=1:length(List.Experiment{iexp}.Device{idevice}.xmlfile) |
|---|
| 347 | FileName=List.Experiment{iexp}.Device{idevice}.xmlfile{ixml}; |
|---|
| 348 | [Title,test]=check_heading(Currentpath,Campaign,ExpName,DeviceName,[],FileName,SubCampaignTest); |
|---|
| 349 | if test |
|---|
| 350 | [List.Experiment{iexp}.Device{idevice}.xmlfile{ixml} ' , Heading updated'] |
|---|
| 351 | end |
|---|
| 352 | if isequal(Title,'ImaDoc') |
|---|
| 353 | [t,uid_xml]=add(t,uid_device,'element','ImaDoc'); |
|---|
| 354 | t = attributes(t,'add',uid_xml,'source','file'); |
|---|
| 355 | [t]=add(t,uid_xml,'chardata',List.Experiment{iexp}.Device{idevice}.xmlfile{ixml}); |
|---|
| 356 | end |
|---|
| 357 | end |
|---|
| 358 | elseif isfield(List.Experiment{iexp}.Device{idevice},'Record') |
|---|
| 359 | for irecord=1:length(List.Experiment{iexp}.Device{idevice}.Record) |
|---|
| 360 | RecordName=List.Experiment{iexp}.Device{idevice}.Record{irecord}.name; |
|---|
| 361 | [t,uid_record]=add(t,uid_device,'element','Record'); |
|---|
| 362 | t = attributes(t,'add',uid_record,'DirName',RecordName); |
|---|
| 363 | if isfield(List.Experiment{iexp}.Device{idevice}.Record{irecord},'xmlfile') |
|---|
| 364 | for ixml=1:length(List.Experiment{iexp}.Device{idevice}.Record{irecord}.xmlfile) |
|---|
| 365 | FileName=List.Experiment{iexp}.Device{idevice}.Record{irecord}.xmlfile{ixml}; |
|---|
| 366 | [Title,test]=check_heading(Currentpath,Campaign,ExpName,DeviceName,RecordName,FileName,SubCampaignTest); |
|---|
| 367 | if test |
|---|
| 368 | [FileName ' , Heading updated'] |
|---|
| 369 | end |
|---|
| 370 | [t,uid_xml]=add(t,uid_record,'element','ImaDoc'); |
|---|
| 371 | t = attributes(t,'add',uid_xml,'source','file'); |
|---|
| 372 | [t]=add(t,uid_xml,'chardata',FileName); |
|---|
| 373 | end |
|---|
| 374 | end |
|---|
| 375 | end |
|---|
| 376 | end |
|---|
| 377 | end |
|---|
| 378 | end |
|---|
| 379 | end |
|---|
| 380 | set(handles.ListExperiments,'Value',1) |
|---|
| 381 | outputdir=get(handles.SourceDir,'String'); |
|---|
| 382 | [path,dirname]=fileparts(outputdir); |
|---|
| 383 | outputfile=fullfile(outputdir,[dirname '.xml']); |
|---|
| 384 | %campaigndoc(t); |
|---|
| 385 | save(t,outputfile) |
|---|
| 386 | |
|---|
| 387 | %------------------------------------------------------------------------ |
|---|
| 388 | % --- Executes on button press in CampaignDoc. |
|---|
| 389 | function edit_xml_Callback(hObject, eventdata, handles) |
|---|
| 390 | %------------------------------------------------------------------------ |
|---|
| 391 | CurrentPath=get(handles.SourceDir,'String'); |
|---|
| 392 | %[CurrentPath,Name,Ext]=fileparts(CurrentDir); |
|---|
| 393 | ListExperiments=get(handles.ListExperiments,'String'); |
|---|
| 394 | Value=get(handles.ListExperiments,'Value'); |
|---|
| 395 | if ~isequal(Value,1) |
|---|
| 396 | ListExperiments=ListExperiments(Value); |
|---|
| 397 | end |
|---|
| 398 | ListDevices=get(handles.ListDevices,'String'); |
|---|
| 399 | Value=get(handles.ListDevices,'Value'); |
|---|
| 400 | if ~isequal(Value,1) |
|---|
| 401 | ListDevices=ListDevices(Value); |
|---|
| 402 | end |
|---|
| 403 | ListRecords=get(handles.ListRecords,'String'); |
|---|
| 404 | Value=get(handles.ListRecords,'Value'); |
|---|
| 405 | if ~isequal(Value,1) |
|---|
| 406 | ListRecords=ListRecords(Value); |
|---|
| 407 | end |
|---|
| 408 | [ListDevices,ListRecords,ListXml,List]=ListDir(CurrentPath,ListExperiments,ListDevices,ListRecords); |
|---|
| 409 | ListXml=get(handles.ListXml,'String'); |
|---|
| 410 | Value=get(handles.ListXml,'Value'); |
|---|
| 411 | set(handles.ListXml,'Value',Value(1)); |
|---|
| 412 | if isequal(Value(1),1) |
|---|
| 413 | msgbox_uvmat('ERROR','an xml file needs to be selected') |
|---|
| 414 | return |
|---|
| 415 | else |
|---|
| 416 | XmlName=ListXml{Value(1)}; |
|---|
| 417 | end |
|---|
| 418 | for iexp=1:length(List.Experiment) |
|---|
| 419 | ExpName=List.Experiment{iexp}.name; |
|---|
| 420 | if isfield(List.Experiment{iexp},'Device') |
|---|
| 421 | for idevice=1:length(List.Experiment{iexp}.Device) |
|---|
| 422 | DeviceName=List.Experiment{iexp}.Device{idevice}.name; |
|---|
| 423 | if isfield(List.Experiment{iexp}.Device{idevice},'xmlfile') |
|---|
| 424 | for ixml=1:length(List.Experiment{iexp}.Device{idevice}.xmlfile) |
|---|
| 425 | FileName=List.Experiment{iexp}.Device{idevice}.xmlfile{ixml} |
|---|
| 426 | if isequal(FileName,XmlName) |
|---|
| 427 | editxml(fullfile(CurrentPath,ExpName,DeviceName,FileName)); |
|---|
| 428 | return |
|---|
| 429 | end |
|---|
| 430 | end |
|---|
| 431 | elseif isfield(List.Experiment{iexp}.Device{idevice},'Record') |
|---|
| 432 | for irecord=1:length(List.Experiment{iexp}.Device{idevice}.Record) |
|---|
| 433 | RecordName=List.Experiment{iexp}.Device{idevice}.Record{irecord}.name; |
|---|
| 434 | if isfield(List.Experiment{iexp}.Device{idevice}.Record{irecord},'xmlfile') |
|---|
| 435 | for ixml=1:length(List.Experiment{iexp}.Device{idevice}.Record{irecord}.xmlfile) |
|---|
| 436 | FileName=List.Experiment{iexp}.Device{idevice}.Record{irecord}.xmlfile{ixml}; |
|---|
| 437 | if isequal(FileName,XmlName) |
|---|
| 438 | editxml(fullfile(CurrentPath,ExpName,DeviceName,RecordName,FileName)); |
|---|
| 439 | return |
|---|
| 440 | end |
|---|
| 441 | end |
|---|
| 442 | end |
|---|
| 443 | end |
|---|
| 444 | end |
|---|
| 445 | end |
|---|
| 446 | end |
|---|
| 447 | end |
|---|
| 448 | |
|---|
| 449 | |
|---|
| 450 | |
|---|
| 451 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|---|
| 452 | % CurrentPath/Campaign: root directory |
|---|
| 453 | function [Title,test_mod]=check_heading(Currentpath,Campaign,Experiment,Device,Record,xmlname,testSubCampaign) |
|---|
| 454 | |
|---|
| 455 | %Shema for Heading: |
|---|
| 456 | % Campaign |
|---|
| 457 | % (SubCampaign) |
|---|
| 458 | % Experiment |
|---|
| 459 | % Device |
|---|
| 460 | % (Record) |
|---|
| 461 | % ImageName |
|---|
| 462 | % DateExp |
|---|
| 463 | % old: %Project: suppressed ( changed to Campaign) |
|---|
| 464 | %Exp: suppressed (changed to experiment) |
|---|
| 465 | %ImaNames: changed to ImageName |
|---|
| 466 | if exist('Record','var') && ~isempty(Record) |
|---|
| 467 | xmlfullname=fullfile(Currentpath,Campaign,Experiment,Device,Record,xmlname); |
|---|
| 468 | testrecord=1; |
|---|
| 469 | else |
|---|
| 470 | xmlfullname=fullfile(Currentpath,Campaign,Experiment,Device,xmlname); |
|---|
| 471 | testrecord=0; |
|---|
| 472 | end |
|---|
| 473 | if ~exist('testSubCampaign','var') |
|---|
| 474 | testSubCampaign=0; |
|---|
| 475 | end |
|---|
| 476 | if testSubCampaign |
|---|
| 477 | SubCampaign=Campaign; |
|---|
| 478 | [Currentpath,Campaign,DirExt]=fileparts(Currentpath); |
|---|
| 479 | Campaign=[Campaign DirExt]; |
|---|
| 480 | end |
|---|
| 481 | test_mod=0; %test for the modification of the xml file |
|---|
| 482 | t_device=xmltree(xmlfullname); |
|---|
| 483 | Title=get(t_device,1,'name'); |
|---|
| 484 | uid_child=children(t_device,1); |
|---|
| 485 | Heading_old=[]; |
|---|
| 486 | uidheading=0; |
|---|
| 487 | for ilist=1:length(uid_child) |
|---|
| 488 | name=get(t_device,uid_child(ilist),'name'); |
|---|
| 489 | if isequal(name,'Heading') |
|---|
| 490 | uidheading=uid_child(ilist); |
|---|
| 491 | end |
|---|
| 492 | end |
|---|
| 493 | if uidheading |
|---|
| 494 | subt=branch(t_device,uidheading); |
|---|
| 495 | Heading_old=convert(subt); |
|---|
| 496 | else |
|---|
| 497 | return % do not edit xml files without element 'Heading' |
|---|
| 498 | end |
|---|
| 499 | if ~(isfield(Heading_old,'Campaign')&& isequal(Heading_old.Campaign,Campaign)) |
|---|
| 500 | test_mod=1; |
|---|
| 501 | end |
|---|
| 502 | Heading.Campaign=Campaign; |
|---|
| 503 | if testSubCampaign |
|---|
| 504 | if ~(isfield(Heading_old,'SubCampaign')&& isequal(Heading_old.SubCampaign,SubCampaign)) |
|---|
| 505 | test_mod=1; |
|---|
| 506 | end |
|---|
| 507 | Heading.SubCampaign=SubCampaign; |
|---|
| 508 | end |
|---|
| 509 | if ~(isfield(Heading_old,'Experiment')&& isequal(Heading_old.Experiment,Experiment)) |
|---|
| 510 | test_mod=1; |
|---|
| 511 | end |
|---|
| 512 | Heading.Experiment=Experiment; |
|---|
| 513 | if ~(isfield(Heading_old,'Device')&& isequal(Heading_old.Device,Device)) |
|---|
| 514 | test_mod=1; |
|---|
| 515 | end |
|---|
| 516 | Heading.Device=Device; |
|---|
| 517 | if testrecord |
|---|
| 518 | if ~(isfield(Heading_old,'Record')&& isequal(Heading_old.Record,Record)) |
|---|
| 519 | test_mod=1; |
|---|
| 520 | end |
|---|
| 521 | Heading.Record=Record; |
|---|
| 522 | end |
|---|
| 523 | if isfield(Heading_old,'ImaNames') |
|---|
| 524 | test_mod=1; |
|---|
| 525 | if ~isempty(Heading_old.ImaNames) |
|---|
| 526 | Heading.ImageName=Heading_old.ImaNames; |
|---|
| 527 | end |
|---|
| 528 | end |
|---|
| 529 | if isfield(Heading_old,'ImageName')&& ~isempty(Heading_old.ImageName) |
|---|
| 530 | Heading.ImageName=Heading_old.ImageName; |
|---|
| 531 | end |
|---|
| 532 | if isfield(Heading_old,'DateExp')&& ~isempty(Heading_old.DateExp) |
|---|
| 533 | Heading.DateExp=Heading_old.DateExp; |
|---|
| 534 | end |
|---|
| 535 | if test_mod && uidheading |
|---|
| 536 | uid_child=children(t_device,uidheading); |
|---|
| 537 | t_device=delete(t_device,uid_child); |
|---|
| 538 | t_device=struct2xml(Heading,t_device,uidheading); |
|---|
| 539 | backupfile=xmlfullname; |
|---|
| 540 | testexist=2; |
|---|
| 541 | while testexist==2 |
|---|
| 542 | backupfile=[backupfile '~']; |
|---|
| 543 | testexist=exist(backupfile,'file'); |
|---|
| 544 | end |
|---|
| 545 | [success,message]=copyfile(xmlfullname,backupfile);%make backup |
|---|
| 546 | if isequal(success,1) |
|---|
| 547 | delete(xmlfullname) |
|---|
| 548 | else |
|---|
| 549 | return |
|---|
| 550 | end |
|---|
| 551 | save(t_device,xmlfullname) |
|---|
| 552 | end |
|---|
| 553 | |
|---|
| 554 | %------------------------------------------------------------------------ |
|---|
| 555 | % --- Executes on button press in HELP. |
|---|
| 556 | function HELP_Callback(hObject, eventdata, handles) |
|---|
| 557 | path_to_uvmat=which ('uvmat')% check the path of uvmat |
|---|
| 558 | pathelp=fileparts(path_to_uvmat); |
|---|
| 559 | helpfile=fullfile(pathelp,'UVMAT_DOC','uvmat_doc.html'); |
|---|
| 560 | if isempty(dir(helpfile)), msgbox_uvmat('ERROR','Please put the help file uvmat_doc.html in the directory UVMAT/UVMAT_DOC') |
|---|
| 561 | else |
|---|
| 562 | web([helpfile '#dataview']) |
|---|
| 563 | end |
|---|
| 564 | |
|---|
| 565 | |
|---|
| 566 | |
|---|
| 567 | % --- Executes on selection change in ListXml. |
|---|
| 568 | function ListXml_Callback(hObject, eventdata, handles) |
|---|
| 569 | Value=get(handles.ListXml,'Value'); |
|---|
| 570 | if isequal(Value(1),1) |
|---|
| 571 | set(handles.ListXml,'Value',1); |
|---|
| 572 | end |
|---|
| 573 | |
|---|
| 574 | |
|---|
| 575 | % --- Executes on button press in clean_civ_cmx. |
|---|
| 576 | function clean_civ_cmx_Callback(hObject, eventdata, handles) |
|---|
| 577 | message='this function will delete all files with extensions .log, .bat, .cmx,.cmx2,.errors in the input directory(ies)'; |
|---|
| 578 | answer=msgbox_uvmat('INPUT_Y-N',message); |
|---|
| 579 | if ~isequal(answer,'Yes') |
|---|
| 580 | return |
|---|
| 581 | end |
|---|
| 582 | set(handles.ListExperiments,'Value',1) |
|---|
| 583 | ListExperiments_Callback(hObject, eventdata, handles)%update the overview of the experiment directories |
|---|
| 584 | DataviewData=get(handles.browse_data,'UserData') |
|---|
| 585 | List=DataviewData.List; |
|---|
| 586 | Currentpath=get(handles.SourceDir,'String'); |
|---|
| 587 | [Currentpath,Campaign,DirExt]=fileparts(Currentpath); |
|---|
| 588 | Campaign=[Campaign DirExt]; |
|---|
| 589 | SubCampaignTest=get(handles.SubCampaignTest,'Value'); |
|---|
| 590 | nbdelete_tot=0; |
|---|
| 591 | for iexp=1:length(List.Experiment) |
|---|
| 592 | set(handles.ListExperiments,'Value',iexp+1) |
|---|
| 593 | drawnow |
|---|
| 594 | test_mod=0; |
|---|
| 595 | ExpName=List.Experiment{iexp}.name; |
|---|
| 596 | nbdelete=0; |
|---|
| 597 | if isfield(List.Experiment{iexp},'Device') |
|---|
| 598 | for idevice=1:length(List.Experiment{iexp}.Device) |
|---|
| 599 | DeviceName=List.Experiment{iexp}.Device{idevice}.name; |
|---|
| 600 | if isfield(List.Experiment{iexp}.Device{idevice},'xmlfile') |
|---|
| 601 | currentdir=fullfile(Currentpath,Campaign,ExpName,DeviceName); |
|---|
| 602 | hdir=dir(currentdir); %list files and dirs |
|---|
| 603 | idir=0; |
|---|
| 604 | for ilist=1:length(hdir) |
|---|
| 605 | if hdir(ilist).isdir |
|---|
| 606 | dirname=hdir(ilist).name; |
|---|
| 607 | if ~isequal(dirname(1),'.')&&~isequal(dirname(1),'0') |
|---|
| 608 | CivDir=fullfile(currentdir,dirname) |
|---|
| 609 | hCivDir=dir(CivDir); |
|---|
| 610 | for ilist=1:length(hCivDir) |
|---|
| 611 | FileName=hCivDir(ilist).name; |
|---|
| 612 | [dd,ff,Ext]=fileparts(FileName); |
|---|
| 613 | if isequal(Ext,'.log')||isequal(Ext,'.bat')||isequal(Ext,'.cmx')||isequal(Ext,'.cmx2')|| isequal(Ext,'.errors') |
|---|
| 614 | delete(fullfile(CivDir,FileName)) |
|---|
| 615 | nbdelete=nbdelete+1; |
|---|
| 616 | end |
|---|
| 617 | end |
|---|
| 618 | end |
|---|
| 619 | end |
|---|
| 620 | end |
|---|
| 621 | elseif isfield(List.Experiment{iexp}.Device{idevice},'Record') |
|---|
| 622 | for irecord=1:length(List.Experiment{iexp}.Device{idevice}.Record) |
|---|
| 623 | RecordName=List.Experiment{iexp}.Device{idevice}.Record{irecord}.name; |
|---|
| 624 | if isfield(List.Experiment{iexp}.Device{idevice}.Record{irecord},'xmlfile') |
|---|
| 625 | 'look at subdirectories' |
|---|
| 626 | end |
|---|
| 627 | end |
|---|
| 628 | end |
|---|
| 629 | end |
|---|
| 630 | end |
|---|
| 631 | display([num2str(nbdelete) ' files deleted']) |
|---|
| 632 | nbdelete_tot=nbdelete_tot+nbdelete; |
|---|
| 633 | end |
|---|
| 634 | msgbox_uvmat('CONFIRMATION',['END: ' num2str(nbdelete_tot) ' files deleted by clean_civ_cmx']) |
|---|
| 635 | set(handles.ListExperiments,'Value',1) |
|---|
| 636 | |
|---|
| 637 | |
|---|
| 638 | % --- Executes on button press in OK. |
|---|
| 639 | function OK_Callback(hObject, eventdata, handles) |
|---|
| 640 | %------------------------------------------------------------------------ |
|---|
| 641 | if strcmp(get(handles.MirrorDir,'Visible'),'on') |
|---|
| 642 | Campaign=get(handles.MirrorDir,'String'); |
|---|
| 643 | else |
|---|
| 644 | Campaign=get(handles.SourceDir,'String'); |
|---|
| 645 | end |
|---|
| 646 | handles.output.Campaign=Campaign; |
|---|
| 647 | Experiment=get(handles.ListExperiments,'String'); |
|---|
| 648 | IndicesExp=get(handles.ListExperiments,'Value'); |
|---|
| 649 | if ~isequal(IndicesExp,1)% if first element ('*') selected all the experiments are selected |
|---|
| 650 | Experiment=Experiment(IndicesExp);% use the selection of the list of experiments |
|---|
| 651 | end |
|---|
| 652 | Device=get(handles.ListDevices,'String'); |
|---|
| 653 | Value=get(handles.ListDevices,'Value'); |
|---|
| 654 | Device=Device(Value); |
|---|
| 655 | handles.output.Experiment=Experiment; |
|---|
| 656 | handles.output.Device=Device; |
|---|
| 657 | guidata(hObject, handles);% Update handles structure |
|---|
| 658 | uiresume(handles.browse_data); |
|---|
| 659 | drawnow |
|---|
| 660 | return |
|---|
| 661 | |
|---|
| 662 | |
|---|
| 663 | % ListRecords=get(handles.ListRecords,'String'); |
|---|
| 664 | % Value=get(handles.ListRecords,'Value'); |
|---|
| 665 | % if ~isequal(Value,1) |
|---|
| 666 | % ListRecords=ListRecords(Value); |
|---|
| 667 | % end |
|---|
| 668 | |
|---|
| 669 | %[ListDevices,ListRecords,ListXml,List]=ListDir(CurrentPath,ListExperiments,ListDevices); |
|---|
| 670 | ListXml=get(handles.ListXml,'String'); |
|---|
| 671 | Value=get(handles.ListXml,'Value'); |
|---|
| 672 | if isequal(Value,1) |
|---|
| 673 | msgbox_uvmat('ERROR','you need to select in the GUI browse_data the xml files to edit') |
|---|
| 674 | return |
|---|
| 675 | else |
|---|
| 676 | ListXml=ListXml(Value); |
|---|
| 677 | end |
|---|
| 678 | |
|---|
| 679 | %update all the selected xml files |
|---|
| 680 | DataviewData=get(handles.browse_data,'UserData'); |
|---|
| 681 | % answer=msgbox_uvmat('INPUT_Y-N',[num2str(length(Value)) ' xml files for device ' ListDevices{1} ' will be refreshed with ' ... |
|---|
| 682 | % DataviewData.GeometryCalib.CalibrationType ' calibration data']) |
|---|
| 683 | % if ~isequal(answer,'Yes') |
|---|
| 684 | % return |
|---|
| 685 | % end |
|---|
| 686 | %List.Experiment{1}.Device{1} |
|---|
| 687 | %List.Experiment{2}.Device{1} |
|---|
| 688 | for iexp=1:length(List.Experiment) |
|---|
| 689 | ExpName=List.Experiment{iexp}.name; |
|---|
| 690 | set(handles.ListExperiments,'Value',IndicesExp(iexp)); |
|---|
| 691 | if isfield(List.Experiment{iexp},'Device') |
|---|
| 692 | for idevice=1:length(List.Experiment{iexp}.Device) |
|---|
| 693 | DeviceName=List.Experiment{iexp}.Device{idevice}.name; |
|---|
| 694 | if isfield(List.Experiment{iexp}.Device{idevice},'xmlfile') |
|---|
| 695 | for ixml=1:length(List.Experiment{iexp}.Device{idevice}.xmlfile) |
|---|
| 696 | FileName=List.Experiment{iexp}.Device{idevice}.xmlfile{ixml}; |
|---|
| 697 | for ilistxml=1:length(ListXml) |
|---|
| 698 | if isequal(FileName,ListXml{ilistxml}) |
|---|
| 699 | set(handles.ListXml,'Value',Value(ilistxml)) |
|---|
| 700 | drawnow |
|---|
| 701 | xmlfullname=fullfile(CurrentPath,ExpName,DeviceName,FileName); |
|---|
| 702 | update_imadoc(DataviewData.GeometryCalib,xmlfullname) |
|---|
| 703 | display([xmlfullname ' updated']) |
|---|
| 704 | break |
|---|
| 705 | end |
|---|
| 706 | end |
|---|
| 707 | end |
|---|
| 708 | elseif isfield(List.Experiment{iexp}.Device{idevice},'Record') |
|---|
| 709 | for irecord=1:length(List.Experiment{iexp}.Device{idevice}.Record) |
|---|
| 710 | RecordName=List.Experiment{iexp}.Device{idevice}.Record{irecord}.name; |
|---|
| 711 | if isfield(List.Experiment{iexp}.Device{idevice}.Record{irecord},'xmlfile') |
|---|
| 712 | for ixml=1:length(List.Experiment{iexp}.Device{idevice}.Record{irecord}.xmlfile) |
|---|
| 713 | FileName=List.Experiment{iexp}.Device{idevice}.Record{irecord}.xmlfile{ixml}; |
|---|
| 714 | for ilistxml=1:length(ListXml) |
|---|
| 715 | if isequal(FileName,ListXml{ilistxml}) |
|---|
| 716 | set(handles.ListXml,'Value',Value(ilistxml)) |
|---|
| 717 | drawnow |
|---|
| 718 | xmlfullname=fullfile(CurrentPath,ExpName,DeviceName,RecordName,FileName); |
|---|
| 719 | update_imadoc(DataviewData.GeometryCalib,xmlfullname) |
|---|
| 720 | display([xmlfullname ' updated']) |
|---|
| 721 | break |
|---|
| 722 | end |
|---|
| 723 | end |
|---|
| 724 | end |
|---|
| 725 | end |
|---|
| 726 | end |
|---|
| 727 | end |
|---|
| 728 | end |
|---|
| 729 | end |
|---|
| 730 | end |
|---|
| 731 | set(handles.ListXml,'Value',Value) |
|---|
| 732 | % |
|---|
| 733 | % |
|---|
| 734 | % |
|---|
| 735 | % |
|---|
| 736 | % |
|---|
| 737 | % |
|---|
| 738 | % |
|---|
| 739 | % CurrentPath=get(handles.SourceDir,'String');%= get(hObject,'String'); |
|---|
| 740 | % ListExperiments=get(handles.ListExperiments,'String'); |
|---|
| 741 | % Value=get(handles.ListExperiments,'Value'); |
|---|
| 742 | % if ~isequal(Value,1) |
|---|
| 743 | % ListExperiments=ListExperiments(Value); |
|---|
| 744 | % end |
|---|
| 745 | % ListDevices=get(handles.ListDevices,'String'); |
|---|
| 746 | % Value=get(handles.ListDevices,'Value'); |
|---|
| 747 | % if isequal(Value,1) |
|---|
| 748 | % msgbox_uvmat('ERROR','manually select in the GUI browse_data the device being calibrated') |
|---|
| 749 | % return |
|---|
| 750 | % else |
|---|
| 751 | % ListDevices=ListDevices(Value); |
|---|
| 752 | % end |
|---|
| 753 | % ListRecords=get(handles.ListRecords,'String'); |
|---|
| 754 | % Value=get(handles.ListRecords,'Value'); |
|---|
| 755 | % if ~isequal(Value,1) |
|---|
| 756 | % ListRecords=ListRecords(Value); |
|---|
| 757 | % end |
|---|
| 758 | % [ListDevices,ListRecords,ListXml,List]=ListDir(CurrentPath,ListExperiments,ListDevices,ListRecords); |
|---|
| 759 | % ListXml=get(handles.ListXml,'String'); |
|---|
| 760 | % Value=get(handles.ListXml,'Value'); |
|---|
| 761 | % if isequal(Value,1) |
|---|
| 762 | % msgbox_uvmat('ERROR','you need to select in the GUI browse_data the xml files to edit') |
|---|
| 763 | % return |
|---|
| 764 | % else |
|---|
| 765 | % ListXml=ListXml(Value); |
|---|
| 766 | % end |
|---|
| 767 | % handles.output.CurrentPath=CurrentPath; |
|---|
| 768 | % handles.output.ListExperiments=ListExperiments; |
|---|
| 769 | % handles.output.ListDevices=ListDevices; |
|---|
| 770 | % handles.output.ListRecords=ListRecords; |
|---|
| 771 | % handles.output.ListXml=ListXml; |
|---|
| 772 | % handles.output.List=List; |
|---|
| 773 | % handles.output ='OK, Calibration replicated'; |
|---|
| 774 | % guidata(hObject, handles);% Update handles structure |
|---|
| 775 | % uiresume(handles.browse_data); |
|---|
| 776 | |
|---|
| 777 | % --- Executes on button press in Cancel. |
|---|
| 778 | function Cancel_Callback(hObject, eventdata, handles) |
|---|
| 779 | handles.output = get(hObject,'String'); |
|---|
| 780 | guidata(hObject, handles); % Update handles structure |
|---|
| 781 | % Use UIRESUME instead of delete because the OutputFcn needs |
|---|
| 782 | uiresume(handles.browse_data); |
|---|
| 783 | |
|---|
| 784 | % --- Executes when user attempts to close browse_data. |
|---|
| 785 | function browse_data_CloseRequestFcn(hObject, eventdata, handles) |
|---|
| 786 | if isequal(get(handles.browse_data, 'waitstatus'), 'waiting') |
|---|
| 787 | % The GUI is still in UIWAIT, us UIRESUME |
|---|
| 788 | uiresume(handles.browse_data); |
|---|
| 789 | else |
|---|
| 790 | % The GUI is no longer waiting, just close it |
|---|
| 791 | delete(handles.browse_data); |
|---|
| 792 | end |
|---|
| 793 | |
|---|
| 794 | % --- Executes on key press over figure1 with no controls selected. |
|---|
| 795 | function browse_data_KeyPressFcn(hObject, eventdata, handles) |
|---|
| 796 | % Check for "enter" or "escape" |
|---|
| 797 | if isequal(get(hObject,'CurrentKey'),'escape') |
|---|
| 798 | % User said no by hitting escape |
|---|
| 799 | handles.output = 'Cancel'; |
|---|
| 800 | |
|---|
| 801 | % Update handles structure |
|---|
| 802 | guidata(hObject, handles); |
|---|
| 803 | |
|---|
| 804 | uiresume(handles.browse_data); |
|---|
| 805 | end |
|---|
| 806 | if isequal(get(hObject,'CurrentKey'),'return') |
|---|
| 807 | uiresume(handles.browse_data); |
|---|
| 808 | end |
|---|