source: trunk/src/series/usr_fct/check_field_series.m @ 1203

Last change on this file since 1203 was 1203, checked in by sommeria, 20 hours ago

civ repaired

File size: 2.9 KB
Line 
1%'check_field_series': checks the existence and type of the input file series
2%------------------------------------------------------------------------
3% function GUIParam=check_data_files(Param)
4%
5%%%%%%%%%%% GENERAL TO ALL SERIES ACTION FCTS %%%%%%%%%%%%%%%%%%%%%%%%%%%
6%OUTPUT
7% GUISeriesParam=list of options in the GUI series.fig needed for the function
8%
9%INPUT:
10% In run mode, the input parameters are given as a Matlab structure Param copied from the GUI series.
11% In batch mode, Param is the name of the corresponding xml file containing the same information
12% In the absence of input (as activated when the current Action is selected
13% in series), the function ouput GUI_input set the activation of the needed GUI elements
14
15function GUIParam=check_field_series(Param)
16
17GUIParam=[];
18
19%% input preparation mode (no RUN)
20if isstruct(Param) && isequal(Param.Action.RUN,0)
21    GUIParam.OutputSubDirMode='auto'; %(options 'none'/'custom'/'auto'/'first'/'last','auto' by default) 
22    GUIParam.OutputDirExt='.check_fields';%set the output dir extension
23     msgbox_uvmat('CONFIMATION','This function will check the series of input fields')
24    return
25end
26%------------------------------------------------------------------------
27
28%% read input parameters from an xml file if input is a file name (batch mode)
29if ischar(Param)
30    Param=xml2struct(Param);% read Param as input file (batch case)
31end
32
33%% root input file(s) and type
34RootPath=Param.InputTable{1,1};
35SubDir=Param.InputTable{1,2};
36RootFile=Param.InputTable{1,3};
37NomType=Param.InputTable{1,4};
38FileExt=Param.InputTable{1,5};
39
40%% scans the series indexed with i and j
41i_index=Param.IndexRange.first_i:Param.IndexRange.incr_i:Param.IndexRange.last_i;
42j_index=Param.IndexRange.first_j:Param.IndexRange.incr_j:Param.IndexRange.last_j;
43FileCell=cell(numel(j_index),numel(i_index));%initiate cell array of input file names
44for ifile=1:numel(i_index)
45    for jfile=1:numel(j_index)
46        FullFileName=fullfile_uvmat(RootPath,SubDir,RootFile,FileExt,NomType,i_index(ifile),[],j_index(jfile));
47        FileName=fullfile_uvmat('','',RootFile,FileExt,NomType,i_index(ifile),[],j_index(jfile));%name without path
48        if exist(FullFileName,'file')
49            FileInfo=get_file_info(FullFileName);% get the info on the file         
50            FileCell{jfile,ifile}=[FileName ': ' FileInfo.FileType];
51        else
52            FileCell{jfile,ifile}=[FileName ': missing'];
53        end
54    end
55end
56
57%% transform cell arrays into text and display in workspace
58OutputText = strjoin(FileCell, '\n'); %transform cell arrays into text
59disp(OutputText) %display the list of files
60
61%% save the list in the appropriate output folder
62OutputPath=fullfile(Param.OutputPath,Param.Experiment,Param.Device);
63OutputSubDir=[Param.OutputSubDir Param.OutputDirExt];
64FullOutputFile=fullfile_uvmat(OutputPath,OutputSubDir,RootFile,'.txt','1-2',i_index(1),i_index(end))
65writelines(OutputText,FullOutputFile);
66
67'END'
68
Note: See TracBrowser for help on using the repository browser.