source: trunk/src/series/time_series.m @ 462

Last change on this file since 462 was 462, checked in by sommeria, 12 years ago

a few bug repairs and update in the series fcts

File size: 25.4 KB
Line 
1%'time_series': extract a time series, used with series.fig
2% this function can be used as a template for applying a global operation on a series of input fields
3%------------------------------------------------------------------------
4% function GUI_input=time_series(Param)
5%
6%%%%%%%%%%% GENERAL TO ALL SERIES ACTION FCTS %%%%%%%%%%%%%%%%%%%%%%%%%%%
7%
8% This function is used in four modes by the GUI series:
9%           1) config GUI: with no input argument, the function determine the suitable GUI configuration
10%           2) interactive input: the function is used to interactively introduce input parameters, and then stops
11%           3) RUN: the function itself runs, when an appropriate input  structure Param has been introduced.
12%           4) BATCH: the function itself proceeds in BATCH mode, using an xml file 'Param' as input.
13%
14% This function is used in four modes by the GUI series:
15%           1) config GUI: with no input argument, the function determine the suitable GUI configuration
16%           2) interactive input: the function is used to interactively introduce input parameters, and then stops
17%           3) RUN: the function itself runs, when an appropriate input  structure Param has been introduced.
18%           4) BATCH: the function itself proceeds in BATCH mode, using an xml file 'Param' as input.
19%
20%OUTPUT
21% GUI_input=list of options in the GUI series.fig needed for the function
22%
23%INPUT:
24% In run mode, the input parameters are given as a Matlab structure Param copied from the GUI series.
25% In batch mode, Param is the name of the corresponding xml file containing the same information
26% In the absence of input (as activated when the current Action is selected
27% in series), the function ouput GUI_input set the activation of the needed GUI elements
28%
29% Param contains the elements:(use the menu bar command 'export/GUI config' in series to see the current structure Param)
30%    .InputTable: cell of input file names, (several lines for multiple input)
31%                      each line decomposed as {RootPath,SubDir,Rootfile,NomType,Extension}
32%    .OutputSubDir: name of the subdirectory for data outputs
33%    .OutputDir: directory for data outputs, including path
34%    .Action: .ActionName: name of the current activated function
35%             .ActionPath:   path of the current activated function
36%    .IndexRange: set the file or frame indices on which the action must be performed
37%    .FieldTransform: .TransformName: name of the selected transform function
38%                     .TransformPath:   path  of the selected transform function
39%                     .TransformHandle: corresponding function handle
40%    .InputFields: sub structure describing the input fields withfields
41%              .FieldName: name of the field
42%              .VelType: velocity type
43%              .FieldName_1: name of the second field in case of two input series
44%              .VelType_1: velocity type of the second field in case of two input series
45%    .ProjObject: %sub structure describing a projection object (read from ancillary GUI set_object)
46%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
47%
48function ParamOut=time_series(Param)
49
50%% set the input elements needed on the GUI series when the action is selected in the menu ActionName
51if ~exist('Param','var') % case with no input parameter
52    ParamOut={'NbViewMax';2;...% max nbre of input file series (default='' , no limitation)
53        'AllowInputSort';'off';...% allow alphabetic sorting of the list of input files (options 'off'/'on', 'off' by default)
54        'WholeIndexRange';'off';...% prescribes the file index ranges from min to max (options 'off'/'on', 'off' by default)
55        'NbSlice';'on'; ...%nbre of slices ('off' by default)
56        'VelType';'two';...% menu for selecting the velocity type (options 'off'/'one'/'two',  'off' by default)
57        'FieldName';'two';...% menu for selecting the field (s) in the input file(options 'off'/'one'/'two', 'off' by default)
58        'FieldTransform'; 'on';...%can use a transform function
59        'ProjObject';'on';...%can use projection object(option 'off'/'on',
60        'Mask';'off';...%can use mask option   (option 'off'/'on', 'off' by default)
61        'OutputDirExt';'.tseries';...%set the output dir extension
62               ''};
63        return
64end
65
66%%%%%%%%%%%% STANDARD PART (DO NOT EDIT) %%%%%%%%%%%%
67%% select different modes,  RUN, parameter input, BATCH
68% BATCH  case: read the xml file for batch case
69if ischar(Param)
70        Param=xml2struct(Param);
71        checkrun=0;
72% RUN case: parameters introduced as the input structure Param
73else
74    hseries=guidata(Param.hseries);%handles of the GUI series
75    WaitbarPos=get(hseries.waitbar_frame,'Position');%position of the waitbar on the GUI series
76    if isfield(Param,'Specific')&& strcmp(Param.Specific,'?')
77        checkrun=1;% will only search interactive input parameters (preparation of BATCH mode)
78    else
79        checkrun=2; % indicate the RUN option is used
80    end
81end
82ParamOut=Param; %default output
83
84%% root input file(s) and type
85RootPath=Param.InputTable(:,1);
86RootFile=Param.InputTable(:,3);
87SubDir=Param.InputTable(:,2);
88NomType=Param.InputTable(:,4);
89FileExt=Param.InputTable(:,5);
90
91% get the set of input file names (cell array filecell), and the lists of
92% input file or frame indices i1_series,i2_series,j1_series,j2_series
93[filecell,i1_series,i2_series,j1_series,j2_series]=get_file_series(Param);
94% filecell{iview,fileindex}: cell array representing the list of file names
95%        iview: line in the table corresponding to a given file series
96%        fileindex: file index within  the file series,
97% i1_series(iview,ref_j,ref_i)... are the corresponding arrays of indices i1,i2,j1,j2, depending on the input line iview and the two reference indices ref_i,ref_j
98% i1_series(iview,fileindex) expresses the same indices as a 1D array in file indices
99% set of frame indices used for movie or multimage input
100% numbers of slices and file indices
101
102NbSlice=1;%default
103if isfield(Param.IndexRange,'NbSlice')&&~isempty(Param.IndexRange.NbSlice)
104    NbSlice=Param.IndexRange.NbSlice;
105end
106nbview=numel(i1_series);%number of input file series (lines in InputTable)
107nbfield_j=size(i1_series{1},1); %nb of fields for the j index (bursts or volume slices)
108nbfield_i=size(i1_series{1},2); %nb of fields for the i index
109nbfield=nbfield_j*nbfield_i; %total number of fields
110nbfield_i=floor(nbfield/NbSlice);%total number of  indexes in a slice (adjusted to an integer number of slices)
111nbfield=nbfield_i*NbSlice; %total number of fields after adjustement
112
113%determine the file type on each line from the first input file
114ImageTypeOptions={'image','multimage','mmreader','video'};
115NcTypeOptions={'netcdf','civx','civdata'};
116for iview=1:nbview
117    if ~exist(filecell{iview,1}','file')
118        msgbox_uvmat('ERROR',['the first input file ' filecell{iview,1} ' does not exist'])
119        return
120    end
121    [FileType{iview},FileInfo{iview},MovieObject{iview}]=get_file_type(filecell{iview,1});
122    CheckImage{iview}=~isempty(find(strcmp(FileType{iview},ImageTypeOptions)));% =1 for images
123    CheckNc{iview}=~isempty(find(strcmp(FileType{iview},NcTypeOptions)));% =1 for netcdf files
124    if ~isempty(j1_series{iview})
125        frame_index{iview}=j1_series{iview};
126    else
127        frame_index{iview}=i1_series{iview};
128    end
129end
130
131%% calibration data and timing: read the ImaDoc files
132mode=''; %default
133timecell={};
134itime=0;
135NbSlice_calib={};
136XmlData=cell(1,nbview);%initiate the structures containing the data from the xml file (calibration and timing)
137for iview=1:nbview%Loop on views
138    SubDirBase=regexprep(SubDir{iview},'\..*','');%take the root part of SubDir, before the first dot '.'
139    filexml=[fullfile(RootPath{iview},SubDirBase) '.xml'];%new convention: xml at the level of the image folder
140    if ~exist(filexml,'file')
141        filexml=[fullfile(RootPath{iview},SubDir{iview},RootFile{iview}) '.xml']; % old convention: xml inside the image folder
142        if ~exist(filexml,'file')
143            filexml=[fullfile(RootPath{iview},SubDir{iview},RootFile{iview}) '.civ']; % very old convention: .civ file
144            if ~exist(filexml,'file')
145                filexml='';
146            end
147        end
148    end
149    if ~isempty(filexml)
150        [XmlData{iview},error]=imadoc2struct(filexml);
151    end
152    if isfield(XmlData{iview},'Time')
153        itime=itime+1;
154        timecell{itime}=XmlData{iview}.Time;
155    end
156    if isfield(XmlData{iview},'GeometryCalib') && isfield(XmlData{iview}.GeometryCalib,'SliceCoord')
157        NbSlice_calib{iview}=size(XmlData{iview}.GeometryCalib.SliceCoord,1);%nbre of slices for Zindex in phys transform
158        if ~isequal(NbSlice_calib{iview},NbSlice_calib{1})
159            msgbox_uvmat('WARNING','inconsistent number of Z indices for the two field series');
160        end
161    end
162end
163
164%% check coincidence in time for several input file series
165multitime=0;
166if isempty(timecell)
167    time=[];
168elseif length(timecell)==1
169    time=timecell{1};
170elseif length(timecell)>1
171    multitime=1;
172    for icell=1:length(timecell)
173        if ~isequal(size(timecell{icell}),size(timecell{1}))
174            msgbox_uvmat('WARNING','inconsistent time array dimensions in ImaDoc fields, the time for the first series is used')
175            time=timecell{1};
176            multitime=0;
177            break
178        end
179    end
180end
181if multitime
182    for icell=1:length(timecell)
183        time(icell,:,:)=timecell{icell};
184    end
185    diff_time=max(max(diff(time)));
186    if diff_time>0
187        msgbox_uvmat('WARNING',['times of series differ by (max) ' num2str(diff_time)])
188    end   
189end
190if size(time,2) < i2_series{1}(end) ||( ~isempty(j2_series{1}) && size(time,3) < j2_series{1}(end))% time array absent or too short in ImaDoc xml file'
191    time=[];
192end
193
194%% coordinate transform or other user defined transform
195transform_fct='';%default
196if isfield(Param,'FieldTransform')&&isfield(Param.FieldTransform,'TransformHandle')
197    transform_fct=Param.FieldTransform.TransformHandle;
198end
199%%%%%%%%%%%% END STANDARD PART  %%%%%%%%%%%%
200 % EDIT FROM HERE
201
202%% check the validity of  input file types
203if CheckImage{1}
204    FileExtOut='.png'; % write result as .png images for image inputs
205elseif CheckNc{1}
206    FileExtOut='.nc';% write result as .nc files for netcdf inputs
207else
208    msgbox_uvmat('ERROR',['invalid file type input ' FileType{1}])
209    return
210end
211if nbview==2 && ~isequal(CheckImage{1},CheckImage{2})
212        msgbox_uvmat('ERROR','input must be two image series or two netcdf file series')
213    return
214end
215NomTypeOut='_1-2_1';% output file index will indicate the first and last ref index in the series
216if NbSlice~=nbfield_j
217    answer=msgbox_uvmat('INPUT_Y-N',['will not average slice by slice: for so cancel and set NbSlice= ' num2str(nbfield_j)]);
218    if ~strcmp(answer,'Yes')
219        return
220    end
221end
222
223%% Set field names and velocity types
224InputFields{1}=[];%default (case of images)
225if isfield(Param,'InputFields')
226    InputFields{1}=Param.InputFields;
227end
228if nbview==2
229    InputFields{2}=[];%default (case of images)
230    if isfield(Param,'InputFields')
231        InputFields{2}=Param.InputFields{1};%default
232        if isfield(Param.InputFields,'FieldName_1')
233            InputFields{2}.FieldName=Param.InputFields.FieldName_1;
234            if isfield(Param.InputFields,'VelType_1')
235                InputFields{2}.VelType=Param.InputFields.VelType_1;
236            end
237        end
238    end
239end
240%%% TO UPDATE
241if isequal(InputFields{1},'get_field...')
242    hget_field=findobj(allchild(0),'name','get_field');%find the get_field... GUI
243    if numel(hget_field)>1
244        delete(hget_field(2:end)) % delete multiple occurerence of the GUI get_fioeld
245    elseif isempty(hget_field)
246        filename=filecell{1,1};
247      % filename=name_generator(filebase{1},i1_series{1}(1),j1_series{1}(1),FileExt{1},NomType{1},1,i2_series{1}(1),num_j2{1}(1),SubDir{1});
248       idetect(iview)=exist(filename,'file');
249       hget_field=get_field(filename);
250       return
251    end
252    SubField=read_get_field(hget_field); %read the names of the variables to plot in the get_field GUI
253    if isempty(SubField)
254        delete(hget_field)
255        filename=filecell{1,1};
256       %filename=name_generator(filebase{1},i1_series{1}(1),j1_series{1}(1),FileExt{1},NomType{1},1,i2_series{1}(1),j2_series{1}(1),SubDir{1});
257        hget_field=get_field(filename);
258        SubField=read_get_field(hget_field); %read the names of the variables to plot in the get_field GUI
259    end
260end
261%%%%%%%
262
263%% Initiate output fields
264%initiate the output structure as a copy of the first input one (reproduce fields)
265[DataOut,ParamOut,errormsg] = read_field(filecell{1,1},FileType{1},InputFields{1},1);
266if ~isempty(errormsg)
267    msgbox_uvmat('ERROR',['error reading ' filecell{1,1} ': ' errormsg])
268    return
269end
270time_1=[];
271if isfield(DataOut,'Time')
272    time_1=DataOut.Time(1);
273end
274if CheckNc{iview}
275    if isempty(strcmp('Conventions',DataOut.ListGlobalAttribute))
276        DataOut.ListGlobalAttribute=['Conventions' DataOut.ListGlobalAttribute];
277    end
278    DataOut.Conventions='uvmat';
279    DataOut.ListGlobalAttribute=[DataOut.ListGlobalAttribute {Param.Action}];
280    ActionKey='Action';
281    while isfield(DataOut,ActionKey)
282        ActionKey=[ActionKey '_1'];
283    end
284    DataOut.(ActionKey)=Param.Action;
285    DataOut.ListGlobalAttribute=[DataOut.ListGlobalAttribute {ActionKey}];
286    if isfield(DataOut,'Time')
287        DataOut.ListGlobalAttribute=[DataOut.ListGlobalAttribute {'Time','Time_end'}];
288    end
289end
290
291%% LOOP ON SLICES
292nbmissing=0; %number of undetected files
293for i_slice=1:NbSlice
294    dt=[];
295    %%%%%%%%%%%%%%%%%%%%%%%%%%%%  LOOP ON FIELDS WITHIN  A SLICE
296    filecounter=0;
297    for ifile=i_slice:NbSlice:nbfield
298        if checkrun
299            update_waitbar(hseries.waitbar_frame,WaitbarPos,ifile/nbfield)
300            stopstate=get(hseries.RUN,'BusyAction');
301        else
302            stopstate='queue';
303        end
304        errormsg='';
305        if isequal(stopstate,'queue')% enable STOP command
306            % loop on views (in case of multiple input series)
307            for iview=1:nbview
308                filename=filecell{iview,ifile};
309               % filename=name_generator(filebase{iview},...
310                %    i1_series{iview}(ifile),j1_series{iview}(ifile),FileExt{iview},NomType{iview},1,i2_series{iview}(ifile),j2_series{iview}(ifile),SubDir{iview});
311                if exist(filename,'file')
312                    try
313                        Data{iview}=[]; %default
314                        if ~isequal(FileType{iview},'netcdf')
315                            Data{iview}.ListVarName={'A'};
316                            Data{iview}.AName='image';
317                            switch FileType{iview}
318                                case 'movie'
319                                    A=read(MovieObject{iview},i1_series{iview}(ifile));
320                                case 'avi'
321                                    mov=aviread(filename,i1_series{iview}(ifile));
322                                    A=frame2im(mov(1));
323                                case 'vol'
324                                    A=imread(filename);
325                                case 'multimage'
326                                    A=imread(filename,i1_series{iview}(ifile));
327                                case 'image'
328                                    A=imread(filename);
329                            end
330                            Data{iview}.ListVarName={'AY','AX','A'}; %
331                            npy=size(A,1);
332                            npx=size(A,2);
333                            nbcolor=size(A,3);
334                            if nbcolor==3
335                                Data{iview}.VarDimName={'AY','AX',{'AY','AX','rgb'}};
336                            else
337                                Data{iview}.VarDimName={'AY','AX',{'AY','AX'}};
338                            end
339                            Data{iview}.AY=[npy-0.5 0.5];
340                            Data{iview}.AX=[0.5 npx-0.5];
341                            Data{iview}.A=double(A);
342                            Data{iview}.CoordUnit='pixel';
343                        elseif testcivx
344                            [Data{iview},VelTypeOut]=read_civxdata(filename,FieldName,VelType);
345                            if ~isequal(FieldName,{''})
346                                Data{iview}=calc_field(FieldName,Data{iview});%calculate field (vort..)
347                            end
348                        else
349                            [Data{iview},var_detect]=nc2struct(filename,SubField.ListVarName); %read the corresponding input data
350                            Data{iview}.VarAttribute=SubField.VarAttribute;
351                        end
352                        if ~isempty(NbSlice_calib)  % z index
353                            Data{iview}.ZIndex=mod(i1_series{iview}(ifile)-1,NbSlice_calib{1})+1;
354                        end
355                    catch ME
356                        errormsg=ME.message;
357                    end
358                else
359                    errormsg=[filename ' is missing'];
360                end
361                if isempty(errormsg)
362                    % coordinate transform (or other user defined transform)
363                    if ~isempty(transform_fct)
364                        if nbview==2
365                            [Data{1},Data{2}]=transform_fct(Data{1},XmlData{1},Data{2},XmlData{2});
366                            if isempty(Data{2})
367                                Data(2)=[];
368                            end
369                        else
370                            Data{1}=transform_fct(Data{1},XmlData{1});
371                        end
372                    end
373                    if length(Data)==2
374                        [Field,errormsg]=sub_field(Data{1},Data{2}); %substract the two fields
375                    else
376                        Field=Data{1};
377                    end
378                    if Param.CheckObject
379                        [Field,errormsg]=proj_field(Field,Param.ProjObject);
380                    end
381                end
382                filecounter=filecounter+1;
383               
384                % initiate the time series at the first iteration
385                if filecounter==1
386                    % stop program if the first field reading is in error
387                    if ~isempty(errormsg)
388                        msgbox_uvmat('ERROR',['error in time_series/sub_field:' errormsg])
389                        return
390                    end
391                    DataOut=Field;%default
392                    DataOut.NbDim=Field.NbDim+1; %add the time dimension for plots
393                    nbvar=length(Field.ListVarName);
394                    if nbvar==0
395                        msgbox_uvmat('ERROR','no input variable selected in get_field')
396                        return
397                    end
398                    testsum=2*ones(1,nbvar);%initiate flag for action on each variable
399                    if isfield(Field,'VarAttribute') % look for coordinate and flag variables
400                        for ivar=1:nbvar
401                            if length(Field.VarAttribute)>=ivar && isfield(Field.VarAttribute{ivar},'Role')
402                                var_role=Field.VarAttribute{ivar}.Role;%'role' of the variable
403                                if isequal(var_role,'errorflag')
404                                    msgbox_uvmat('ERROR','do not handle error flags in time series')
405                                    return
406                                end
407                                if isequal(var_role,'warnflag')
408                                    testsum(ivar)=0;  % not recorded variable
409                                    eval(['DataOut=rmfield(DataOut,''' Field.ListVarName{ivar} ''');']);%remove variable
410                                end
411                                if isequal(var_role,'coord_x')| isequal(var_role,'coord_y')|...
412                                        isequal(var_role,'coord_z')|isequal(var_role,'coord')
413                                    testsum(ivar)=1; %constant coordinates, record without time evolution
414                                end
415                            end
416                            % check whether the variable ivar is a dimension variable
417                            DimCell=Field.VarDimName{ivar};
418                            if ischar(DimCell)
419                                DimCell={DimCell};
420                            end
421                            if numel(DimCell)==1 && isequal(Field.ListVarName{ivar},DimCell{1})%detect dimension variables
422                                testsum(ivar)=1;
423                            end
424                        end
425                    end
426                    for ivar=1:nbvar
427                        if testsum(ivar)==2
428                            eval(['DataOut.' Field.ListVarName{ivar} '=[];'])
429                        end
430                    end
431                    DataOut.ListVarName=[{'Time'} DataOut.ListVarName];
432                end
433               
434                % add data to the current field
435                for ivar=1:length(Field.ListVarName)
436                    VarName=Field.ListVarName{ivar};
437                    VarVal=Field.(VarName);
438                    if testsum(ivar)==2% test for recorded variable
439                        if isempty(errormsg)
440                            if isequal(Param.ProjObject.ProjMode,'inside')% take the average in the domain for 'inside' mode
441                                if isempty(VarVal)
442                                    msgbox_uvmat('ERROR',['empty result at frame index ' num2str(i1_series{iview}(ifile))])
443                                    return
444                                end
445                                VarVal=mean(VarVal,1);
446                            end
447                            VarVal=shiftdim(VarVal,-1); %shift dimension
448                            DataOut.(VarName)=cat(1,DataOut.(VarName),VarVal);%concanete the current field to the time series
449                        else
450                            DataOut.(VarName)=cat(1,DataOut.(VarName),0);% put each variable to 0 in case of input reading error
451                        end
452                    elseif testsum(ivar)==1% variable representing fixed coordinates
453                        eval(['VarInit=DataOut.' VarName ';']);
454                        if isempty(errormsg) && ~isequal(VarVal,VarInit)
455                            msgbox_uvmat('ERROR',['time series requires constant coordinates ' VarName])
456                            return
457                        end
458                    end
459                end
460               
461                % record the time:
462                if isempty(time)% time read in ncfiles
463                    if isfield(Field,'Time')
464                        DataOut.Time(filecounter,1)=Field.Time;
465                    else
466                        DataOut.Time(filecounter,1)=ifile;%default
467                    end
468                else % time from ImaDoc prevails  TODO: correct
469                  %  DataOut.Time(filecounter,1)=time{1}(i1_series{1})(ifile),j1_series{1}(ifile))+time(end,i2_series{end}(ifile),j2_series{end}(ifile)))/2;
470                  DataOut.Time(filecounter,1)=i1_series{1}(ifile);% TODO : generalise
471                end
472               
473                % record the number of missing input fields
474                if ~isempty(errormsg)
475                    nbmissing=nbmissing+1;
476                    display(['ifile=' num2str(ifile) ':' errormsg])
477                end
478            end
479        end
480    end
481    %%%%%%% END OF LOOP WITHIN A SLICE
482   
483    %remove time for global attributes if exists
484    Time_index=find(strcmp('Time',DataOut.ListGlobalAttribute));
485    if ~isempty(Time_index)
486        DataOut.ListGlobalAttribute(Time_index)=[];
487    end
488    DataOut.Conventions='uvmat';
489    for ivar=1:numel(DataOut.ListVarName)
490        VarName=DataOut.ListVarName{ivar};
491        eval(['DataOut.' VarName '=squeeze(DataOut.' VarName ');']) %remove singletons
492    end
493   
494    % add time dimension
495    for ivar=1:length(Field.ListVarName)
496        DimCell=Field.VarDimName(ivar);
497        if testsum(ivar)==2%variable used as time series
498            DataOut.VarDimName{ivar}=[{'Time'} DimCell];
499        elseif testsum(ivar)==1
500            DataOut.VarDimName{ivar}=DimCell;
501        end
502    end
503    indexremove=find(~testsum);
504    if ~isempty(indexremove)
505        DataOut.ListVarName(1+indexremove)=[];
506        DataOut.VarDimName(indexremove)=[];
507        if isfield(DataOut,'Role') && ~isempty(DataOut.Role{1})%generaliser aus autres attributs
508            DataOut.Role(1+indexremove)=[];
509        end
510    end
511   
512    %shift variable attributes
513    if isfield(DataOut,'VarAttribute')
514        DataOut.VarAttribute=[{[]} DataOut.VarAttribute];
515    end
516    DataOut.VarDimName=[{'Time'} DataOut.VarDimName];
517    DataOut.Action=Param.Action;%name of the processing programme
518    test_time=diff(DataOut.Time)>0;% test that the readed time is increasing (not constant)
519    if ~test_time
520        DataOut.Time=[1:filecounter];
521    end
522   
523    % display nbmissing
524    if ~isequal(nbmissing,0)
525        msgbox_uvmat('WARNING',[num2str(nbmissing) ' files skipped: missing files or bad input, see command window display'])
526    end
527   
528    %name of result file
529%     filemean=fullfile_uvmat(RootPath{1},subdir_result,RootFile{1},'.nc','_1',i1_series{1}(i_slice));
530    OutputFile=fullfile_uvmat(RootPath{1},Param.OutputSubDir,RootFile{1},FileExtOut,NomTypeOut,i1_series{1}(1),i1_series{1}(end),i_slice,[]);
531    errormsg=struct2nc(OutputFile,DataOut); %save result file
532    if isempty(errormsg)
533        display([OutputFile ' written'])
534    else
535        msgbox_uvmat('ERROR',['error in Series/struct2nc: ' errormsg])
536    end
537end
538
539%% plot the time series (the last one in case of multislices)
540figure
541haxes=axes;
542plot_field(DataOut,haxes)
543
544%% display the result file using the GUI get_field
545hget_field=findobj(allchild(0),'name','get_field');
546if ~isempty(hget_field)
547    delete(hget_field)
548end
549get_field(OutputFile,DataOut)
550   
551
552
Note: See TracBrowser for help on using the repository browser.