Home > . > dataview.m

dataview

PURPOSE ^

TEST 'dataview': function for scanning directories in a campaign (TEST)

SYNOPSIS ^

function varargout = dataview(varargin)

DESCRIPTION ^

TEST 'dataview': function for scanning directories in a campaign (TEST)
------------------------------------------------------------------------
 function varargout = series(varargin)
 associated with the GUI dataview.fig

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
  Copyright Joel Sommeria, 2008, LEGI / CNRS-UJF-INPG, sommeria@coriolis-legi.org.
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
     This file is part of the toolbox UVMAT.
 
     UVMAT is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
     the Free Software Foundation; either version 2 of the License, or
     (at your option) any later version.
 
     UVMAT is distributed in the hope that it will be useful,
     but WITHOUT ANY WARRANTY; without even the implied warranty of
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     GNU General Public License (file UVMAT/COPYING.txt) for more details.
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 %TEST 'dataview': function for scanning directories in a campaign (TEST)
0002 %------------------------------------------------------------------------
0003 % function varargout = series(varargin)
0004 % associated with the GUI dataview.fig
0005 %
0006 %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
0007 %  Copyright Joel Sommeria, 2008, LEGI / CNRS-UJF-INPG, sommeria@coriolis-legi.org.
0008 %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
0009 %     This file is part of the toolbox UVMAT.
0010 %
0011 %     UVMAT is free software; you can redistribute it and/or modify
0012 %     it under the terms of the GNU General Public License as published by
0013 %     the Free Software Foundation; either version 2 of the License, or
0014 %     (at your option) any later version.
0015 %
0016 %     UVMAT is distributed in the hope that it will be useful,
0017 %     but WITHOUT ANY WARRANTY; without even the implied warranty of
0018 %     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0019 %     GNU General Public License (file UVMAT/COPYING.txt) for more details.
0020 %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
0021 
0022 function varargout = dataview(varargin)
0023 
0024 % Last Modified by GUIDE v2.5 28-Apr-2009 00:12:36
0025 
0026 % Begin initialization code - DO NOT EDIT
0027 gui_Singleton = 1;
0028 gui_State = struct('gui_Name',       mfilename, ...
0029                    'gui_Singleton',  gui_Singleton, ...
0030                    'gui_OpeningFcn', @dataview_OpeningFcn, ...
0031                    'gui_OutputFcn',  @dataview_OutputFcn, ...
0032                    'gui_LayoutFcn',  [] , ...
0033                    'gui_Callback',   []);
0034 if nargin & isstr(varargin{1})
0035     gui_State.gui_Callback = str2func(varargin{1});
0036 end
0037 
0038 if nargout
0039     [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
0040 else
0041     gui_mainfcn(gui_State, varargin{:});
0042 end
0043 % End initialization code - DO NOT EDIT
0044 
0045 
0046 % --- Executes just before dataview is made visible.
0047 function dataview_OpeningFcn(hObject, eventdata, handles, varargin)
0048 
0049 % Choose default command line output for dataview
0050 handles.output = hObject;
0051 
0052 % Update handles structure
0053 guidata(hObject, handles);
0054 
0055 %----------------------------------------------------------------
0056 % --- Outputs from this function are returned to the command line.
0057 function varargout = dataview_OutputFcn(hObject, eventdata, handles)
0058 
0059 % Get default command line output from handles structure
0060 varargout{1} = handles.output;
0061 
0062 
0063 
0064 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0065 %------------------------------------------------------
0066 % --- Executes on button press in browser.
0067 function browser_Callback(hObject, eventdata, handles)
0068 %------------------------------------------------------------------------
0069 
0070 CurrentFile='/coriolis/bigone/PROJETS';%get(handles.RootDirectory,'String');
0071 set(handles.SubCampaignTest,'Value',0)
0072 CampaignDir=uigetdir(CurrentFile,'Open the Campaign directory'); %file browser
0073 set(handles.RootDirectory,'String',CampaignDir)
0074 RootDirectory_Callback(hObject, eventdata, handles)
0075 
0076 % --- Executes on button press in open_SubCampaign.
0077 function OpenSubCampaign_Callback(hObject, eventdata, handles)
0078 CurrentFile='/coriolis/bigone/PROJETS';%get(handles.RootDirectory,'String');
0079 set(handles.SubCampaignTest,'Value',1)
0080 CampaignDir=uigetdir(CurrentFile,'Open the Campaign directory'); %file browser
0081 set(handles.RootDirectory,'String',CampaignDir)
0082 
0083 RootDirectory_Callback(hObject, eventdata, handles)
0084 
0085 %------------------------------------------------------------------------
0086 
0087 function RootDirectory_Callback(hObject, eventdata, handles)
0088 CampaignDir=get(handles.RootDirectory,'String');
0089 if exist(CampaignDir,'dir')
0090     hdir=dir(CampaignDir); %list files and dirs
0091     idir=0;
0092     for ilist=1:length(hdir)
0093         if hdir(ilist).isdir
0094             dirname=hdir(ilist).name;
0095             if ~isequal(dirname(1),'.')&&~isequal(dirname(1),'0')
0096                 idir=idir+1;
0097                 ExpName{idir}=hdir(ilist).name;
0098             end
0099             % look for the list of 'devices'
0100         else
0101             %warning for isolated files
0102         end
0103     end
0104     set(handles.ListExperiments,'String',[{'*'};ExpName'])
0105     set(handles.ListExperiments,'Value',1)
0106     ListExperiments_Callback(hObject, eventdata, handles)
0107 else
0108     warndlg_uvmat(['The input ' CampaignDir ' is not a directory'],'ERROR')
0109 end
0110 
0111 %------------------------------------------------------------------------
0112 % --- Executes on selection change in ListExperiments.
0113  function ListExperiments_Callback(hObject, eventdata, handles)
0114 CurrentPath=get(handles.RootDirectory,'String');
0115 ListExperiments=get(handles.ListExperiments,'String');
0116 list_val=get(handles.ListExperiments,'Value');
0117 if isequal(list_val(1),1)
0118     ListExperiments=ListExperiments(2:end); %choose all experiments
0119     testList=1;
0120     set(handles.ListExperiments,'Value',1)
0121 else
0122     ListExperiments=ListExperiments(list_val);%choose selected experiments
0123     testList=0;
0124 end
0125 set(handles.ListDevices,'Value',1)
0126 set(handles.ListRecords,'Value',1)
0127 set(handles.ListXml,'Value',1)
0128 [ListDevices,ListRecords,ListXml,List]=ListDir(CurrentPath,ListExperiments,{},{});
0129 set(handles.ListRecords,'String',[{'*'};ListRecords'])
0130 set(handles.ListDevices,'String',[{'*'};ListDevices'])
0131 set(handles.ListXml,'String',[{'*'};ListXml'])
0132 if testList
0133     hh=get(handles.ListExperiments,'parent');
0134     set(hh,'UserData',List)
0135 end
0136 set(handles.CampaignDoc,'Visible','on')
0137 set(handles.edit_xml,'Visible','on')
0138 
0139 %------------------------------------------------------------------------
0140 % --- Executes on button press in update_headings.
0141 function ListDevices_Callback(hObject, eventdata, handles)
0142 CurrentPath=get(handles.RootDirectory,'String');
0143 ListExperiments=get(handles.ListExperiments,'String');
0144 list_val=get(handles.ListExperiments,'Value');
0145 if isequal(list_val,1)
0146     ListExperiments=ListExperiments(2:end);
0147 else
0148     ListExperiments=ListExperiments(list_val);
0149 end
0150 set(handles.ListRecords,'Value',1)
0151 set(handles.ListXml,'Value',1)
0152 ListDevices=get(handles.ListDevices,'String');
0153 list_val=get(handles.ListDevices,'Value');
0154 if isequal(list_val,1)
0155     ListDevices=ListDevices(2:end);
0156 else
0157     ListDevices=ListDevices(list_val);
0158 end
0159 [ListDevices,ListRecords,ListXml]=ListDir(CurrentPath,ListExperiments,ListDevices,{});
0160 set(handles.ListRecords,'String',[{'*'};ListRecords'])
0161 set(handles.ListXml,'String',[{'*'};ListXml'])
0162 
0163 
0164 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0165 
0166 
0167 
0168 %------------------------------------------------------------------------
0169 % --- Executes on selection change in ListRecords.
0170 function ListRecords_Callback(hObject, eventdata, handles)
0171 Value=get(handles.ListRecords,'Value');
0172 if isequal(Value(1),1)
0173     set(handles.ListRecords,'Value',1);
0174 end
0175 
0176 %------------------------------------------------------------------------
0177 % --- Executes on button press in CampaignDoc.
0178 function CampaignDoc_Callback(hObject, eventdata, handles)
0179 %------------------------------------------------------------------------
0180 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')
0181 if ~isequal(answer{1},'OK')
0182     return
0183 end
0184 set(handles.ListExperiments,'Value',1)
0185 ListExperiments_Callback(hObject, eventdata, handles)%update the overview of the experiment directories
0186 hh=get(handles.CampaignDoc,'parent');
0187 List=get(hh,'UserData');
0188 Currentpath=get(handles.RootDirectory,'String');
0189 [Currentpath,Campaign,DirExt]=fileparts(Currentpath);
0190 Campaign=[Campaign DirExt];
0191 t=xmltree;
0192 t=set(t,1,'name','CampaignDoc');
0193 t = attributes(t,'add',1,'source','directory');
0194 SubCampaignTest=get(handles.SubCampaignTest,'Value');
0195 root_uid=1;
0196 if SubCampaignTest
0197     %TO DO open an exoiting xml doc
0198     [t,root_uid]=add(t,1,'element','SubCampaign');
0199     t =attributes(t,'add',root_uid,'DirName',Campaign);
0200 end
0201 for iexp=1:length(List.Experiment)
0202     set(handles.ListExperiments,'Value',iexp+1)
0203     drawnow
0204     test_mod=0;
0205     [t,uid_exp]=add(t,root_uid,'element','Experiment');
0206     t = attributes(t,'add',uid_exp,'i',num2str(iexp));
0207     ExpName=List.Experiment{iexp}.name;
0208     t = attributes(t,'add',uid_exp,'DirName',List.Experiment{iexp}.name);
0209    
0210     if isfield(List.Experiment{iexp},'Device')
0211         for idevice=1:length(List.Experiment{iexp}.Device)
0212             [t,uid_device]=add(t,uid_exp,'element','Device');
0213             DeviceName=List.Experiment{iexp}.Device{idevice}.name;
0214             t = attributes(t,'add',uid_device,'DirName',List.Experiment{iexp}.Device{idevice}.name);       
0215             if isfield(List.Experiment{iexp}.Device{idevice},'xmlfile')
0216                 for ixml=1:length(List.Experiment{iexp}.Device{idevice}.xmlfile)
0217                     FileName=List.Experiment{iexp}.Device{idevice}.xmlfile{ixml};
0218                     [Title,test]=check_heading(Currentpath,Campaign,ExpName,DeviceName,[],FileName,SubCampaignTest);
0219                     if test
0220                         [List.Experiment{iexp}.Device{idevice}.xmlfile{ixml} ' , Heading updated']
0221                     end
0222                     if isequal(Title,'ImaDoc')
0223                         [t,uid_xml]=add(t,uid_device,'element','ImaDoc');
0224                         t = attributes(t,'add',uid_xml,'source','file');
0225                         [t]=add(t,uid_xml,'chardata',List.Experiment{iexp}.Device{idevice}.xmlfile{ixml});                    
0226                     end
0227                 end
0228              elseif isfield(List.Experiment{iexp}.Device{idevice},'Record')
0229                 for irecord=1:length(List.Experiment{iexp}.Device{idevice}.Record)
0230                     RecordName=List.Experiment{iexp}.Device{idevice}.Record{irecord}.name;
0231                     [t,uid_record]=add(t,uid_device,'element','Record');
0232                     t = attributes(t,'add',uid_record,'DirName',RecordName);
0233                     if isfield(List.Experiment{iexp}.Device{idevice}.Record{irecord},'xmlfile')
0234                         for ixml=1:length(List.Experiment{iexp}.Device{idevice}.Record{irecord}.xmlfile)
0235                             FileName=List.Experiment{iexp}.Device{idevice}.Record{irecord}.xmlfile{ixml};
0236                             [Title,test]=check_heading(Currentpath,Campaign,ExpName,DeviceName,RecordName,FileName,SubCampaignTest);
0237                             if test
0238                                 [FileName ' , Heading updated']
0239                             end
0240                             [t,uid_xml]=add(t,uid_record,'element','ImaDoc');
0241                             t = attributes(t,'add',uid_xml,'source','file');
0242                             [t]=add(t,uid_xml,'chardata',FileName);
0243                         end
0244                     end
0245                 end
0246             end
0247         end
0248     end
0249 end
0250 set(handles.ListExperiments,'Value',1)
0251 outputdir=get(handles.RootDirectory,'String');
0252 [path,dirname]=fileparts(outputdir);
0253 outputfile=fullfile(outputdir,[dirname '.xml']);
0254 %campaigndoc(t);
0255 save(t,outputfile)
0256 
0257 %------------------------------------------------------------------------
0258 % --- Executes on button press in CampaignDoc.
0259 function edit_xml_Callback(hObject, eventdata, handles)
0260 %------------------------------------------------------------------------
0261 CurrentPath=get(handles.RootDirectory,'String');
0262 %[CurrentPath,Name,Ext]=fileparts(CurrentDir);
0263 ListExperiments=get(handles.ListExperiments,'String');
0264 Value=get(handles.ListExperiments,'Value');
0265 if ~isequal(Value,1)
0266     ListExperiments=ListExperiments(Value);
0267 end
0268 ListDevices=get(handles.ListDevices,'String');
0269 Value=get(handles.ListDevices,'Value');
0270 if ~isequal(Value,1)
0271     ListDevices=ListDevices(Value);
0272 end
0273 ListRecords=get(handles.ListRecords,'String');
0274 Value=get(handles.ListRecords,'Value');
0275 if ~isequal(Value,1)
0276     ListRecords=ListRecords(Value);
0277 end
0278 [ListDevices,ListRecords,ListXml,List]=ListDir(CurrentPath,ListExperiments,ListDevices,ListRecords);
0279 ListXml=get(handles.ListXml,'String');
0280 Value=get(handles.ListXml,'Value');
0281 set(handles.ListXml,'Value',Value(1));
0282 if isequal(Value(1),1)
0283     warndlg_uvmat('an xml file needs to be selected','ERROR')
0284    return
0285 else
0286     XmlName=ListXml{Value(1)};
0287 end
0288 for iexp=1:length(List.Experiment)
0289     ExpName=List.Experiment{iexp}.name;
0290     if isfield(List.Experiment{iexp},'Device')
0291         for idevice=1:length(List.Experiment{iexp}.Device)
0292             DeviceName=List.Experiment{iexp}.Device{idevice}.name;
0293             if isfield(List.Experiment{iexp}.Device{idevice},'xmlfile')
0294                 for ixml=1:length(List.Experiment{iexp}.Device{idevice}.xmlfile)
0295                     FileName=List.Experiment{iexp}.Device{idevice}.xmlfile{ixml}
0296                     if isequal(FileName,XmlName)
0297                         editxml(fullfile(CurrentPath,ExpName,DeviceName,FileName));
0298                         return
0299                     end
0300                 end
0301              elseif isfield(List.Experiment{iexp}.Device{idevice},'Record')
0302                 for irecord=1:length(List.Experiment{iexp}.Device{idevice}.Record)
0303                     RecordName=List.Experiment{iexp}.Device{idevice}.Record{irecord}.name;
0304                     if isfield(List.Experiment{iexp}.Device{idevice}.Record{irecord},'xmlfile')
0305                         for ixml=1:length(List.Experiment{iexp}.Device{idevice}.Record{irecord}.xmlfile)
0306                             FileName=List.Experiment{iexp}.Device{idevice}.Record{irecord}.xmlfile{ixml};
0307                             if isequal(FileName,XmlName)
0308                                 editxml(fullfile(CurrentPath,ExpName,DeviceName,RecordName,FileName));
0309                                 return
0310                             end                          
0311                         end
0312                     end
0313                 end
0314             end
0315         end
0316     end
0317 end
0318 
0319 
0320 
0321 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0322 % CurrentPath/Campaign: root directory
0323 function  [Title,test_mod]=check_heading(Currentpath,Campaign,Experiment,Device,Record,xmlname,testSubCampaign)
0324 
0325  %Shema for Heading:
0326 %  Campaign
0327 %  (SubCampaign)
0328 % Experiment
0329 %  Device
0330 %  (Record)
0331 %  ImageName
0332 %  DateExp
0333 %                 old: %Project: suppressed ( changed to Campaign)
0334                        %Exp: suppressed (changed to experiment)
0335                        %ImaNames: changed to ImageName
0336 if exist('Record','var') && ~isempty(Record)
0337     xmlfullname=fullfile(Currentpath,Campaign,Experiment,Device,Record,xmlname);  
0338     testrecord=1;
0339 else
0340     xmlfullname=fullfile(Currentpath,Campaign,Experiment,Device,xmlname); 
0341     testrecord=0;
0342 end
0343 if ~exist('testSubCampaign','var')
0344     testSubCampaign=0;
0345 end
0346 if testSubCampaign
0347    SubCampaign=Campaign;
0348    [Currentpath,Campaign,DirExt]=fileparts(Currentpath);
0349    Campaign=[Campaign DirExt];
0350 end
0351 test_mod=0; %test for the modification of the xml file
0352 t_device=xmltree(xmlfullname);
0353 Title=get(t_device,1,'name');
0354 uid_child=children(t_device,1);
0355 Heading_old=[];
0356 uidheading=0;
0357 for ilist=1:length(uid_child)
0358     name=get(t_device,uid_child(ilist),'name');
0359     if isequal(name,'Heading')
0360         uidheading=uid_child(ilist);
0361     end
0362 end
0363 if uidheading
0364     subt=branch(t_device,uidheading);
0365     Heading_old=convert(subt);
0366 else
0367    return % do not edit xml files without element 'Heading'
0368 end
0369 if ~(isfield(Heading_old,'Campaign')&& isequal(Heading_old.Campaign,Campaign))
0370     test_mod=1;
0371 end
0372 Heading.Campaign=Campaign;
0373 if testSubCampaign
0374     if ~(isfield(Heading_old,'SubCampaign')&& isequal(Heading_old.SubCampaign,SubCampaign))
0375         test_mod=1;
0376     end
0377     Heading.SubCampaign=SubCampaign;
0378 end
0379 if ~(isfield(Heading_old,'Experiment')&& isequal(Heading_old.Experiment,Experiment))
0380     test_mod=1;
0381 end
0382 Heading.Experiment=Experiment;
0383 if ~(isfield(Heading_old,'Device')&& isequal(Heading_old.Device,Device))
0384     test_mod=1;
0385 end
0386 Heading.Device=Device;
0387 if testrecord
0388     if ~(isfield(Heading_old,'Record')&& isequal(Heading_old.Record,Record))
0389         test_mod=1;
0390     end
0391     Heading.Record=Record;
0392 end
0393 if isfield(Heading_old,'ImaNames')
0394     test_mod=1;
0395     if  ~isempty(Heading_old.ImaNames)
0396         Heading.ImageName=Heading_old.ImaNames;
0397     end
0398 end
0399 if isfield(Heading_old,'ImageName')&& ~isempty(Heading_old.ImageName)
0400     Heading.ImageName=Heading_old.ImageName;
0401 end
0402 if isfield(Heading_old,'DateExp')&& ~isempty(Heading_old.DateExp)
0403     Heading.DateExp=Heading_old.DateExp;
0404 end
0405 if test_mod && uidheading
0406      uid_child=children(t_device,uidheading);
0407      t_device=delete(t_device,uid_child);
0408     t_device=struct2xml(Heading,t_device,uidheading);
0409     backupfile=xmlfullname;
0410     testexist=2;
0411     while testexist==2
0412        backupfile=[backupfile '~'];
0413        testexist=exist(backupfile,'file');
0414     end
0415     [success,message]=copyfile(xmlfullname,backupfile);%make backup
0416     if isequal(success,1)
0417         delete(xmlfullname)
0418     else
0419         return
0420     end
0421     save(t_device,xmlfullname)
0422 end
0423 
0424 % --- Executes on button press in HELP.
0425 function HELP_Callback(hObject, eventdata, handles)
0426 path_to_uvmat=which ('uvmat')% check the path of uvmat
0427 pathelp=fileparts(path_to_uvmat);
0428 helpfile=fullfile(pathelp,'UVMAT_DOC','uvmat_doc.html');
0429 if isempty(dir(helpfile)), errordlg('Please put the help file uvmat_doc.html in the directory UVMAT/UVMAT_DOC')
0430 else
0431 web([helpfile '#dataview'])    
0432 end
0433 
0434 
0435 
0436 
0437 % --- Executes on button press in SubCampaignTest.
0438 function SubCampaignTest_Callback(hObject, eventdata, handles)
0439 
0440 
0441 % --- Executes on selection change in ListXml.
0442 function ListXml_Callback(hObject, eventdata, handles)
0443 Value=get(handles.ListXml,'Value');
0444 if isequal(Value(1),1)
0445     set(handles.ListXml,'Value',1);
0446 end
0447 
0448 
0449 % --- Executes on button press in clean_civ_cmx.
0450 function clean_civ_cmx_Callback(hObject, eventdata, handles)
0451 message='this function will delete all files with extensions .log, .bat, .cmx,.cmx2,.errors in the input directory(ies)';
0452 answer=msgbox_uvmat('INPUT_Y-N',message);
0453 if ~isequal(answer{1},'OK')
0454     return
0455 end
0456 set(handles.ListExperiments,'Value',1)
0457 ListExperiments_Callback(hObject, eventdata, handles)%update the overview of the experiment directories
0458 hh=get(handles.CampaignDoc,'parent');
0459 List=get(hh,'UserData');
0460 Currentpath=get(handles.RootDirectory,'String');
0461 [Currentpath,Campaign,DirExt]=fileparts(Currentpath);
0462 Campaign=[Campaign DirExt];
0463 SubCampaignTest=get(handles.SubCampaignTest,'Value');
0464 nbdelete_tot=0;
0465 for iexp=1:length(List.Experiment)
0466     set(handles.ListExperiments,'Value',iexp+1)
0467     drawnow
0468     test_mod=0;
0469     ExpName=List.Experiment{iexp}.name;  
0470     nbdelete=0;
0471     if isfield(List.Experiment{iexp},'Device')
0472         for idevice=1:length(List.Experiment{iexp}.Device)
0473             DeviceName=List.Experiment{iexp}.Device{idevice}.name;     
0474             if isfield(List.Experiment{iexp}.Device{idevice},'xmlfile')
0475                 currentdir=fullfile(Currentpath,Campaign,ExpName,DeviceName);
0476                 hdir=dir(currentdir); %list files and dirs
0477                 idir=0;
0478                 for ilist=1:length(hdir)
0479                     if hdir(ilist).isdir
0480                         dirname=hdir(ilist).name;
0481                         if ~isequal(dirname(1),'.')&&~isequal(dirname(1),'0')
0482                             CivDir=fullfile(currentdir,dirname)
0483                             hCivDir=dir(CivDir);
0484                             for ilist=1:length(hCivDir)
0485                                 FileName=hCivDir(ilist).name;
0486                                 [dd,ff,Ext]=fileparts(FileName);
0487                                 if isequal(Ext,'.log')||isequal(Ext,'.bat')||isequal(Ext,'.cmx')||isequal(Ext,'.cmx2')|| isequal(Ext,'.errors')
0488                                     delete(fullfile(CivDir,FileName))
0489                                     nbdelete=nbdelete+1;
0490                                 end
0491                             end
0492                         end
0493                     end
0494                 end
0495              elseif isfield(List.Experiment{iexp}.Device{idevice},'Record')
0496                 for irecord=1:length(List.Experiment{iexp}.Device{idevice}.Record)
0497                     RecordName=List.Experiment{iexp}.Device{idevice}.Record{irecord}.name;
0498                     if isfield(List.Experiment{iexp}.Device{idevice}.Record{irecord},'xmlfile')
0499                         'look at subdirectories'
0500                     end
0501                 end
0502             end
0503         end
0504     end
0505     display([num2str(nbdelete) ' files deleted'])
0506     nbdelete_tot=nbdelete_tot+nbdelete;
0507 end
0508 msgbox_uvmat('CONFIRMATION',['END: ' num2str(nbdelete_tot) ' files deleted by clean_civ_cmx'])
0509 set(handles.ListExperiments,'Value',1)
0510 
0511 
0512 
0513

Generated on Fri 13-Nov-2009 11:17:03 by m2html © 2003