Changeset 651 for trunk/src/series.m
- Timestamp:
- Jun 25, 2013, 12:48:10 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/series.m
r650 r651 153 153 if isfield(h,'MenuFile') 154 154 for ifile=1:min(length(h.MenuFile),5) 155 eval(['set(handles.MenuFile_' num2str(ifile) ',''Label'',h.MenuFile{ifile});']) 155 set(handles.(['MenuFile_' num2str(ifile)]),'Label',h.MenuFile{ifile}); 156 end 157 end 158 %get the list of previous camapigns in the upper bar menu Open campaign 159 if isfield(h,'MenuCampaign') 160 for ifile=1:min(length(h.MenuCampaign),5) 161 set(handles.(['MenuCampaign_' num2str(ifile)]),'Label',h.MenuCampaign{ifile}); 156 162 end 157 163 end … … 224 230 set(handles.Coord_y,'Value',Param.Coord_y_val);% selected string index 225 231 end 226 227 %% Adjust the GUI according to the binaries available in PARAM.xml228 % path_uvmat=fileparts(which('uvmat')); %path to civ229 % addpath (path_uvmat) ; %add the path to civ, (useful in case of change of working directory after civ has been s opened in the working directory)230 % errormsg=[];%default error message231 % xmlfile='PARAM.xml';232 % if exist(xmlfile,'file')233 % try234 % t=xmltree(xmlfile);235 % sparam=convert(t);236 % catch ME237 % errormsg={' Unable to read the file PARAM.xml defining the binaries:';ME.message};238 % end239 % else240 % errormsg=[xmlfile ' not found: path to binaries undefined'];241 % end242 % if ~isempty(errormsg)243 % msgbox_uvmat('WARNING',errormsg);244 % end245 % test_batch=0;%default: ,no batch mode available246 % if isfield(sparam,'BatchParam') && isfield(sparam.BatchParam,'BatchMode')247 % test_batch=strcmp(sparam.BatchParam.BatchMode,'sge'); %sge is currently the only implemented batch mod248 % end249 % RUNVal=get(handles.RunMode,'Value');250 % if test_batch==0251 % if RUNVal>2252 % set(handles.RunMode,'Value',1)253 % end254 % set(handles.RunMode,'String',{'local';'background'})255 % else256 % set(handles.RunMode,'String',{'local';'background';'cluster'})257 % end258 232 259 233 %% introduce the input file name(s) if defined from input Param … … 296 270 %------------------------------------------------------------------------ 297 271 %------------------------------------------------------------------------ 272 % --- fct activated by the browser under 'Open' 273 %------------------------------------------------------------------------ 298 274 function MenuBrowse_Callback(hObject, eventdata, handles) 299 %------------------------------------------------------------------------ 300 % get the previous input file in the Input Table275 276 %% look for the previously opened file 'oldfile' 301 277 oldfile=''; %default 302 SeriesData=get(handles.series,'UserData'); 303 if isfield(SeriesData,'RefFile') 304 oldfile=SeriesData.RefFile{1}; 305 end 306 if ~exist(oldfile,'file') 278 if get(handles.CheckAppend,'Value') 279 % case 'checkappend': new series appended to the input table 280 InputTable=get(handles.InputTable,'Data'); 281 RootPathCell=InputTable(:,1); 282 SubDirCell=InputTable(:,3); 283 oldfile=''; %default 284 if ~(isempty(RootPathCell) || isequal(RootPathCell,{''}))%loads the previously stored file name and set it as default in the file_input box 285 oldfile=fullfile(RootPathCell{1},SubDirCell{1}); 286 end 287 else 288 % case refresh the input table by a new series 289 SeriesData=get(handles.series,'UserData'); 290 if isfield(SeriesData,'RefFile') 291 oldfile=SeriesData.RefFile{1}; 292 end 293 end 294 295 %% use a file name stored in prefdir 296 dir_perso=prefdir; 297 profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); 298 if exist(profil_perso,'file') 299 h=load (profil_perso); 300 if isfield(h,'RootPath') && ischar(h.RootPath) 301 oldfile=h.RootPath; 302 end 303 end 304 305 %% launch the browser 306 fileinput=uigetfile_uvmat('pick a file to append in the input table',oldfile); 307 if ~isempty(fileinput) 308 if get(handles.CheckAppend,'Value') 309 display_file_name(handles,fileinput,'append') 310 else 311 display_file_name(handles,fileinput,'one') 312 end 313 end 314 315 %------------------------------------------------------------------------ 316 % --- fct activated by selecting a previous file under the menu Open 317 %------------------------------------------------------------------------ 318 function MenuFile_Callback(hObject, eventdata, handles) 319 320 fileinput=get(hObject,'Label'); 321 if get(handles.CheckAppend,'Value') 322 display_file_name(handles,fileinput,'append') 323 else 324 display_file_name(handles,fileinput,'one') 325 end 326 327 %------------------------------------------------------------------------ 328 % --- fct activated by the browser under 'Open campaign' 329 %------------------------------------------------------------------------ 330 function MenuBrowseCampaign_Callback(hObject, eventdata, handles) 331 332 set(handles.MenuOpenCampaign,'ForegroundColor',[1 1 0]) 333 drawnow 334 InputTable=get(handles.InputTable,'Data'); 335 RootPath=InputTable{1,1}; 336 CampaignPath=fileparts(fileparts(RootPath)); 337 DirFull=uigetfile_uvmat('define this path as the Campaign folder:',CampaignPath,'uigetdir'); 338 if ~ischar(DirFull)|| ~exist(DirFull,'dir') 339 return 340 end 341 OutPut=browse_data(DirFull);% open the GUI browse_data to get select a campaign dir, experiment and device 342 if ~isfield(OutPut,'Campaign') 343 return 344 end 345 DirName=fullfile(OutPut.Campaign,OutPut.Experiment{1},OutPut.DataSeries{1}); 346 ListStruct=dir(DirName); %list files and the dir DataSeries 347 % select the first appropriate file in the dir 348 FileName=''; 349 for ilist=1:numel(ListStruct) 350 if ~isequal(ListStruct(ilist).isdir,1)%look for files, not dir 351 FileName=ListStruct(ilist).name; 352 FileType=get_file_type(fullfile(DirName,FileName)); 353 switch FileType 354 case {'image','multimage','civx','civdata','netcdf'} 355 break 356 end 357 end 358 end 359 if isempty(FileName) 360 msgbox_uvmat('ERROR',['no appropriate input file in the DataSeries folder ' fullfile(DirName)]) 361 return 362 end 363 364 %% update the list of campaigns in the menubar 365 MenuCampaign=[{get(handles.MenuCampaign_1,'Label')};{get(handles.MenuCampaign_2,'Label')};... 366 {get(handles.MenuCampaign_3,'Label')};{get(handles.MenuCampaign_4,'Label')};{get(handles.MenuCampaign_5,'Label')}]; 367 check_dir=isempty(find(strcmp(DirFull,MenuCampaign))); 368 if check_dir %insert the new campaign in the list if it is not found 369 MenuCampaign(end)=[]; %suppress the last item 370 MenuCampaign=[{DirFull};MenuCampaign];%insert the new campaign 371 for ilist=1:numel(MenuCampaign) 372 set(handles.(['MenuCampaign_' num2str(ilist)]),'Label',MenuCampaign{ilist}) 373 end 374 % save the list for future opening: 307 375 dir_perso=prefdir; 308 376 profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); 309 377 if exist(profil_perso,'file') 310 h=load (profil_perso); 311 if isfield(h,'RootPath')&&ischar(h.RootPath) 312 oldfile=h.RootPath; 313 end 314 end 315 end 316 fileinput=uigetfile_uvmat('pick a file to refresh the input table',oldfile); 317 if ~isempty(fileinput) 318 display_file_name(handles,fileinput,'one') 319 end 320 378 save (profil_perso,'MenuCampaign','RootPath','-append'); %store the file names for future opening of uvmat 379 else 380 save (profil_perso,'MenuCampaign','RootPath','-V6'); %store the file names for future opening of uvmat 381 end 382 end 383 384 %% display the selected field and related information 385 if get(handles.CheckAppend,'Value') 386 display_file_name(handles,fullfile(DirName,FileName),'append') 387 else 388 display_file_name(handles,fullfile(DirName,FileName),'one') 389 end 390 set(handles.MenuOpenCampaign,'ForegroundColor',[0 0 0]) 321 391 322 392 % -------------------------------------------------------------------- 323 function MenuFile_1_Callback(hObject, eventdata, handles) 324 fileinput=get(handles.MenuFile_1,'Label'); 325 display_file_name(handles,fileinput,'one') 326 327 % -------------------------------------------------------------------- 328 function MenuFile_2_Callback(hObject, eventdata, handles) 329 fileinput=get(handles.MenuFile_2,'Label'); 330 display_file_name(handles,fileinput,'one') 331 332 % -------------------------------------------------------------------- 333 function MenuFile_3_Callback(hObject, eventdata, handles) 334 fileinput=get(handles.MenuFile_3,'Label'); 335 display_file_name( handles,fileinput,'one') 336 337 % -------------------------------------------------------------------- 338 function MenuFile_4_Callback(hObject, eventdata, handles) 339 fileinput=get(handles.MenuFile_4,'Label'); 340 display_file_name(handles,fileinput,'one') 341 342 % -------------------------------------------------------------------- 343 function MenuFile_5_Callback(hObject, eventdata, handles) 344 fileinput=get(handles.MenuFile_5,'Label'); 345 display_file_name(handles,fileinput,'one') 346 347 % -------------------------------------------------------------------- 348 function MenuBrowse_insert_Callback(hObject, eventdata, handles) 349 InputTable=get(handles.InputTable,'Data'); 350 RootPathCell=InputTable(:,1); 351 SubDirCell=InputTable(:,3); 352 RootFileCell=InputTable(:,2); 353 oldfile=''; %default 354 if isempty(RootPathCell)||isequal(RootPathCell,{''})%loads the previously stored file name and set it as default in the file_input box 355 dir_perso=prefdir; 356 profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); 357 if exist(profil_perso,'file') 358 h=load (profil_perso); 359 if isfield(h,'filebase')&ischar(h.filebase) 360 oldfile=h.filebase; 361 end 362 if isfield(h,'RootPath')&ischar(h.RootPath) 363 oldfile=h.RootPath; 364 end 365 end 366 else 367 oldfile=fullfile(RootPathCell{1},RootFileCell{1}); 368 end 369 fileinput=uigetfile_uvmat('pick a file to append in the input table',oldfile); 370 if ~isempty(fileinput) 371 display_file_name(handles,fileinput,'append') 372 end 373 % [FileName, PathName, filterindex] = uigetfile( ... 374 % {'*.xml;*.xls;*.png;*.avi;*.AVI;*.nc', ' (*.xml,*.xls, *.png, *.avi,*.nc)'; 375 % '*.xml', '.xml files '; ... 376 % '*.xls', '.xls files '; ... 377 % '*.png','.png image files'; ... 378 % '*.avi;*.AVI','.avi movie files'; ... 379 % '*.nc','.netcdf files'; ... 380 % '*.*', 'All Files (*.*)'}, ... 381 % 'Pick a file',oldfile); 382 % fileinput=[PathName FileName];%complete file name 383 % sizf=size(fileinput); 384 % if (~ischar(fileinput)|~isequal(sizf(1),1)),return;end 385 % [path,name,ext]=fileparts(fileinput); 386 % if isequal(ext,'.xml') 387 % msgbox_uvmat('ERROR','input file type not implemented')%A Faire: ouvrir le fichier pour naviguer 388 % elseif isequal(ext,'.xls') 389 % msgbox_uvmat('ERROR','input file type not implemented')%A Faire: ouvrir le fichier pour naviguer 390 % else 391 % display_file_name(handles,fileinput,'append') 392 % end 393 394 % -------------------------------------------------------------------- 395 function MenuFile_insert_1_Callback(hObject, eventdata, handles) 396 % -------------------------------------------------------------------- 397 fileinput=get(handles.MenuFile_insert_1,'Label'); 398 display_file_name(handles,fileinput,'append') 399 400 % -------------------------------------------------------------------- 401 function MenuFile_insert_2_Callback(hObject, eventdata, handles) 402 % -------------------------------------------------------------------- 403 fileinput=get(handles.MenuFile_insert_2,'Label'); 404 display_file_name(handles,fileinput,'append') 405 406 % -------------------------------------------------------------------- 407 function MenuFile_insert_3_Callback(hObject, eventdata, handles) 408 % -------------------------------------------------------------------- 409 fileinput=get(handles.MenuFile_insert_3,'Label'); 410 display_file_name( handles,fileinput,'append') 411 412 % -------------------------------------------------------------------- 413 function MenuFile_insert_4_Callback(hObject, eventdata, handles) 414 % -------------------------------------------------------------------- 415 fileinput=get(handles.MenuFile_insert_4,'Label'); 416 display_file_name( handles,fileinput,'append') 417 418 % -------------------------------------------------------------------- 419 function MenuFile_insert_5_Callback(hObject, eventdata, handles) 420 % -------------------------------------------------------------------- 421 fileinput=get(handles.MenuFile_insert_5,'Label'); 422 display_file_name(handles,fileinput,'append') 393 function MenuCampaign_Callback(hObject, eventdata, handles) 394 % -------------------------------------------------------------------- 395 set(handles.MenuOpenCampaign,'ForegroundColor',[1 1 0]) 396 OutPut=browse_data(get(hObject,'Label'));% open the GUI browse_data to get select a campaign dir, experiment and device 397 if ~isfield(OutPut,'Campaign') 398 return 399 end 400 DirName=fullfile(OutPut.Campaign,OutPut.Experiment{1},OutPut.DataSeries{1}); 401 hdir=dir(DirName); %list files and dirs 402 for ilist=1:numel(hdir) 403 if ~isequal(hdir(ilist).isdir,1)%look for files, not dir 404 FileName=hdir(ilist).name; 405 FileType=get_file_type(fullfile(DirName,FileName)); 406 switch FileType 407 case {'image','multimage','civx','civdata','netcdf'} 408 break 409 end 410 end 411 end 412 if get(handles.CheckAppend,'Value') 413 display_file_name(handles,fullfile(DirName,FileName),'append') 414 else 415 display_file_name(handles,fullfile(DirName,FileName),'one') 416 end 417 set(handles.MenuOpenCampaign,'ForegroundColor',[0 0 0]) 418 419 423 420 424 421 %------------------------------------------------------------------------ … … 434 431 end 435 432 %% enable other menus and uicontrols 436 set(handles.MenuOpen _insert,'Enable','on')437 set(handles.Menu File_insert_1,'Enable','on')438 set(handles.Menu File_insert_2,'Enable','on')439 set(handles.Menu File_insert_3,'Enable','on')440 set(handles.Menu File_insert_4,'Enable','on')441 set(handles.Menu File_insert_5,'Enable','on')433 set(handles.MenuOpenCampaign,'Enable','on') 434 set(handles.MenuCampaign_1,'Enable','on') 435 set(handles.MenuCampaign_2,'Enable','on') 436 set(handles.MenuCampaign_3,'Enable','on') 437 set(handles.MenuCampaign_4,'Enable','on') 438 set(handles.MenuCampaign_5,'Enable','on') 442 439 set(handles.RUN, 'Enable','On') 443 440 set(handles.RUN,'BackgroundColor',[1 0 0])% set RUN button to red … … 492 489 % iview: line index in the input table 493 490 % or 'one': refresh the list 494 % ' append': add a new line to the list491 % 'checkappend': add a new line to the list 495 492 496 493 %% get the input root name, indices, file extension and nomenclature NomType … … 521 518 522 519 %% enable other menus and uicontrols 523 set(handles.MenuOpen _insert,'Enable','on')524 set(handles.Menu File_insert_1,'Enable','on')525 set(handles.Menu File_insert_2,'Enable','on')526 set(handles.Menu File_insert_3,'Enable','on')527 set(handles.Menu File_insert_4,'Enable','on')528 set(handles.Menu File_insert_5,'Enable','on')520 set(handles.MenuOpenCampaign,'Enable','on') 521 set(handles.MenuCampaign_1,'Enable','on') 522 set(handles.MenuCampaign_2,'Enable','on') 523 set(handles.MenuCampaign_3,'Enable','on') 524 set(handles.MenuCampaign_4,'Enable','on') 525 set(handles.MenuCampaign_5,'Enable','on') 529 526 set(handles.RUN, 'Enable','On') 530 527 set(handles.RUN,'BackgroundColor',[1 0 0])% set RUN button to red … … 595 592 for ifile=1:min(length(MenuFile),5) 596 593 eval(['set(handles.MenuFile_' num2str(ifile) ',''Label'',MenuFile{ifile});']) 597 eval(['set(handles.MenuFile_insert_' num2str(ifile) ',''Label'',MenuFile{ifile});'])598 594 end 599 595 dir_perso=prefdir; … … 731 727 %% number of slices set by default 732 728 NbSlice=1;%default 733 % read value set by the first series for the append mode (iwiew >1)729 % read value set by the first series for the checkappend mode (iwiew >1) 734 730 if iview>1 && strcmp(get(handles.num_NbSlice,'Visible'),'on') 735 731 NbSlice=str2num(get(handles.num_NbSlice,'String')); … … 738 734 %% default time unit 739 735 TimeUnit=''; 740 % read value set by the first series for the append mode (iwiew >1)736 % read value set by the first series for the checkappend mode (iwiew >1) 741 737 if iview>1 742 738 TimeUnit=get(handles.TimeUnit,'String');
Note: See TracChangeset
for help on using the changeset viewer.