Ignore:
Timestamp:
Jul 10, 2019, 12:17:42 PM (20 months ago)
Author:
sommeria
Message:

browse_data updated

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/browse_data.m

    r1068 r1069  
    9292    InputDir=pwd;% current dir is the starting data series by default
    9393end
    94 
    95 [ExpWithPath,DataSeries]=fileparts(InputDir);
    96 [Experiment,Device,Ext]=fileparts(ExpWithPath);
    97 Device=[Device Ext];
    98 [SourceDir,Experiment,Ext]=fileparts(Experiment);
    99 Experiment=[Experiment Ext];
    100 % [tild,CampaignName]=fileparts(Campaign);
    101 % RootXml=fullfile(Campaign,[CampaignName '.xml']);
     94if ischar(InputDir),InputDir={InputDir};end
     95for ilist=1:numel(InputDir)
     96    [ExpWithPath,DataSeries{ilist},Ext]=fileparts(InputDir{ilist});
     97    DataSeries{ilist}=['+/' DataSeries{ilist} Ext];
     98    [Experiment{ilist},Device{ilist},Ext]=fileparts(ExpWithPath);
     99    Device{ilist}=['+/' Device{ilist} Ext];
     100    [SourceDir{ilist},Experiment{ilist},Ext]=fileparts(Experiment{ilist});
     101    Experiment{ilist}=['+/' Experiment{ilist} Ext];
     102    if ~strcmp(SourceDir{ilist},SourceDir{1})||~strcmp(Experiment{ilist},Experiment{1})
     103        msgbox_uvmat('ERROR','replicate cannot be used with multiple root folders')
     104        return
     105    end
     106    if ~strcmp(DataSeries{ilist},DataSeries{1})
     107        set(handles.DataSeries,'enable','off')
     108    end
     109    if ~strcmp(Device{ilist},Device{1})
     110        set(handles.ListDevices,'enable','off')
     111    end
     112end
    102113s=[];
    103114% if exist(RootXml,'file')
     
    111122% end
    112123if isempty(s) %a source dir has been opened
    113     set(handles.SourceDir,'String',SourceDir);
     124    set(handles.SourceDir,'String',SourceDir{1});
    114125    set(handles.MirrorDir,'Visible','off');% no mirror dir display
    115126    set(handles.CreateMirror,'String','create_mirror')
    116127end
    117 set(handles.DataSeries,'String',{['+/' DataSeries]});
    118 set(handles.ListDevices,'String',{['+/' Device]});
    119 errormsg=scan_campaign(handles,SourceDir,['+/' Experiment]);
     128set(handles.DataSeries,'String',DataSeries);
     129set(handles.DataSeries,'Value',(1:numel(DataSeries)));
     130set(handles.ListDevices,'String',Device);
     131set(handles.ListDevices,'Value',(1:numel(Device)));
     132errormsg=scan_campaign(handles,SourceDir{1},Experiment{1});
    120133if ~isempty(errormsg)
    121134    msgbox_uvmat('ERROR',errormsg)
     
    242255Device=ListDevices(list_val);%choose selected devices
    243256end
    244 [ListFiles,indices]=list_dir_2(SourceDir,ListExperiments,Device);
     257check_fix=strcmp(get(handles.ListDevices,'enable'),'off');
     258[ListFiles,indices]=list_dir_2(SourceDir,ListExperiments,Device,check_fix);
    245259set(handles.ListDevices,'String',ListFiles)
    246260set(handles.ListDevices,'Value',indices)% initialise the menu selection with the folder defined by the input
     
    271285    DataSeries=[];
    272286end
    273 [ListFiles,indices]=list_dir_3(SourceDir,ListExperiments,ListDevices,DataSeries);
     287check_fix=strcmp(get(handles.DataSeries,'enable'),'off');
     288[ListFiles,indices]=list_dir_3(SourceDir,ListExperiments,ListDevices,DataSeries,check_fix);
    274289set(handles.DataSeries,'String',ListFiles)
    275290set(handles.DataSeries,'Value',indices)% initialise the menu selection with the folder defined by the input
     
    346361% Provide a list to display
    347362%------------------------------------------------------------------------
    348 function [ListFilesTot,indices]=list_dir_2(SourceDir,ListDir,ListSub)
     363function [ListFilesTot,indices]=list_dir_2(SourceDir,ListDir,ListSub,check_fix)
    349364ListFilesTot={};
    350365for ilist=1:numel(ListDir)
     
    358373    cell_remove=regexp(ListFiles,'^(-|\.|\+/\.)');% detect strings beginning by '-' ,'.' or '+/.'(dir beginning by . )
    359374    check_keep=cellfun('isempty', cell_remove);
    360     ListFilesTot=[ListFilesTot;(ListFiles(check_keep))'];
     375    ListFilesTot=[ListFilesTot (ListFiles(check_keep))];
    361376    end
    362377end
     
    370385        indices=[indices index];
    371386    end
     387    if check_fix
     388        index_init=1:numel(ListFilesTot);
     389        %indices=sort(indices)
     390        index_init(indices)=[];
     391       ListFilesTot=ListFilesTot([indices index_init]);
     392       indices=1:numel(indices);
     393    end     
    372394end
    373395if isempty(indices), indices=1; end
     
    377399% Provide a list to display
    378400%------------------------------------------------------------------------
    379 function [ListFilesTot,indices]=list_dir_3(SourceDir,ListDir,ListSub,ListSubSub)
     401function [ListFilesTot,indices]=list_dir_3(SourceDir,ListDir,ListSub,ListSubSub,check_fix)
    380402ListFilesTot={};
    381403for ilist=1:numel(ListDir)
     
    392414                cell_remove=regexp(ListFiles,'^(-|\.|\+/\.)');% detect strings beginning by '-' ,'.' or '+/.'(dir beginning by . )
    393415                check_keep=cellfun('isempty', cell_remove);
    394                 ListFilesTot=[ListFilesTot;(ListFiles(check_keep))'];
     416                ListFilesTot=[ListFilesTot (ListFiles(check_keep))];
    395417            end
    396418        end
     
    406428        indices=[indices index];
    407429    end
     430    if check_fix
     431        index_init=1:numel(ListFilesTot);
     432        index_init(indices)=[];
     433       ListFilesTot=ListFilesTot([indices index_init]);
     434       indices=1:numel(indices);
     435    end     
    408436end
    409437if isempty(indices), indices=1; end
Note: See TracChangeset for help on using the changeset viewer.