Ignore:
Timestamp:
Jul 9, 2019, 10:10:18 AM (5 years ago)
Author:
sommeria
Message:

replicate updated

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/geometry_calib.m

    r1063 r1068  
    273273        hbrowse=findobj(allchild(0),'Tag','browse_data');
    274274        if ~isempty(hbrowse)% look for the GUI 'replicate'
    275             BrowseHandles=guidata(hbrowse);
    276             SourceDir=get(BrowseHandles.SourceDir,'String');
    277             ListExperiments=get(BrowseHandles.ListExperiments,'String');
    278             ListValues=get(BrowseHandles.ListExperiments,'Value');
    279             ListExperiments=ListExperiments(ListValues);
    280             DataSeries=get(BrowseHandles.DataSeries,'String');
    281             Val=get(BrowseHandles.DataSeries,'Value');
    282             DataFolder=DataSeries{Val};
    283             for ilist=1:numel(ListExperiments)
    284                 SubDirBase=regexprep(DataFolder,'+/','');
    285                 ListExperiments{ilist}=regexprep(ListExperiments{ilist},'+/','');
    286                 XmlName=fullfile(SourceDir,ListExperiments{ilist},[SubDirBase '.xml']);
     275            BrowseData=guidata(hbrowse);
     276            SourceDir=get(BrowseData.SourceDir,'String');
     277            ListExp=get(BrowseData.ListExperiments,'String');
     278            ExpIndices=get(BrowseData.ListExperiments,'Value');
     279            ListExp=ListExp(ExpIndices);
     280            ListDevices=get(BrowseData.ListDevices,'String');
     281            DeviceIndices=get(BrowseData.ListDevices,'Value');
     282            ListDevices=ListDevices(DeviceIndices);
     283            ListDataSeries=get(BrowseData.DataSeries,'String');
     284            DataSeriesIndices=get(BrowseData.DataSeries,'Value');
     285            ListDataSeries=ListDataSeries(DataSeriesIndices);
     286            NbExp=0; % counter of the number of experiments set by the GUI browse_data
     287            for iexp=1:numel(ListExp)
     288                if ~isempty(regexp(ListExp{iexp},'^\+/'))% if it is a folder
     289                    for idevice=1:numel(ListDevices)
     290                        if ~isempty(regexp(ListDevices{idevice},'^\+/'))% if it is a folder
     291                            for isubdir=1:numel(ListDataSeries)
     292                                if ~isempty(regexp(ListDataSeries{isubdir},'^\+/'))% if it is a folder
     293                                    lpath= fullfile(SourceDir,regexprep(ListExp{iexp},'^\+/',''),...
     294                                        regexprep(ListDevices{idevice},'^\+/',''));
     295                                    ldir= regexprep(ListDataSeries{isubdir},'^\+/','');
     296                                    if exist(fullfile(lpath,ldir),'dir')
     297                                        NbExp=NbExp+1;
     298                                        ListPath{NbExp}=lpath;
     299                                        ListSubdir{NbExp}=ldir;
     300                                        ExpIndex{NbExp}=iexp;
     301                                    end
     302                                end
     303                            end
     304                        end
     305                    end
     306                end
     307            end
     308            for iexp=1:NbExp
     309                XmlName=fullfile(ListPath{iexp},[ListSubdir{iexp} '.xml']);
     310                if exist(XmlName,'file')
     311                    check_update=1;
     312                else
     313                    check_update=0;
     314                end
    287315                errormsg=update_imadoc(GeometryCalib,XmlName,'GeometryCalib');% introduce the calibration data in the xml file
    288316                if ~strcmp(errormsg,'')
    289317                    msgbox_uvmat('ERROR',errormsg);
    290318                else
    291                     display([XmlName ' updated with calibration parameters'])
     319                    if check_update
     320                        display([XmlName ' updated with calibration parameters'])
     321                    else
     322                        display([XmlName ' created with calibration parameters'])
     323                    end
    292324                    nbcalib=nbcalib+1;
    293325                end
    294326            end
    295327        end
    296         msgbox_uvmat('CONFIMATION',[SubDirBase ' calibrated for ' num2str(nbcalib) ' experiments']); 
     328        msgbox_uvmat('CONFIMATION',['calibration replicated for ' num2str(NbExp) ' experiments']);
    297329    else
    298330        %% copy the xml file from the old location if appropriate, then update with the calibration parameters
Note: See TracChangeset for help on using the changeset viewer.