Index: /trunk/src/check_files.m
===================================================================
--- /trunk/src/check_files.m	(revision 605)
+++ /trunk/src/check_files.m	(revision 606)
@@ -193,8 +193,11 @@
 for ilist=1:numel(list_compile)
     mfile=regexprep(list_compile(ilist).name,'.sh$','.m');
-    datfile=dir(mfile);
-    if isfield(datfile,'datenum') && datfile.datenum>list_compile(ilist).datenum
-        checkmsg=[checkmsg;{[list_compile(ilist).name ' needs to be updated by compile_functions']}];
-    end
-end
-
+    if exist(mfile,'file')
+        datfile=dir(mfile);
+        if ~isempty(datfile) && isfield(datfile,'datenum') && datfile.datenum>list_compile(ilist).datenum
+            checkmsg=[checkmsg;{[list_compile(ilist).name ' needs to be updated by compile_functions']}];
+        end
+    end
+end
+cd(currentdir)
+
Index: /trunk/src/compile.m
===================================================================
--- /trunk/src/compile.m	(revision 605)
+++ /trunk/src/compile.m	(revision 606)
@@ -6,10 +6,10 @@
 %FctName: name of the Matlab fct to compile (without .m extension)
 %
-function compile (FctName)
+function compile (FctName,SubfctPath)
 if isempty(which('mcc'))
     msgbox_uvmat('no Matlab compiler toolbox mcc installed')
     return
 end
-display(['compiling ' FctName ' ...'])
+disp(['compiling ' FctName ' ...'])
 % commands to compile civ_matlab and eventually other functions
 if ~exist('bin','dir')
@@ -19,10 +19,16 @@
     end
 end
-eval(['mcc -m -R -nojvm -R -nodisplay ' FctName '.m']);
-system(['mv -f ' FctName ' bin/']);
-system(['sed -e ''''s#/' FctName '#/bin/' FctName '#'''' run_' FctName '.sh > ' FctName '.sh']);
-system(['rm run_' FctName '.sh']);
-system(['chmod +x ' FctName '.sh']);
+if ~isempty(SubfctPath)
+    SubfctPath=['-I ' SubfctPath];%string indicating the option of including the path SubfctPath
+end
+disp(['mcc -m -R -nojvm -R -nodisplay ' SubfctPath ' ' FctName '.m'])
+eval(['mcc -m -R -nojvm -R -nodisplay ' SubfctPath ' ' FctName '.m'])% compile the source file [FctName .m], which produces a binary file FctName and a cmd file [run_' FctName '.sh]
+%eval(['mcc -m -R -nojvm -R -nodisplay ' FctName '.m'])% compile the source file [FctName .m], which produces a binary file FctName and a cmd file [run_' FctName 
+system(['mv -f ' FctName ' bin/']);%move the binary file FctName to the subdir /bin
+system(['sed -e ''''s#/' FctName '#/bin/' FctName '#'''' run_' FctName '.sh > ' FctName '.sh']);%modify the cmd file and copy it to [FctName '.sh']
+system(['rm run_' FctName '.sh']);% remove the initial cmd file [run_' FctName '.sh]
+system(['chmod +x ' FctName '.sh']); % set the cmd file to 'executable'
 display('** END **')
+end
 
 
Index: /trunk/src/fill_GUI.m
===================================================================
--- /trunk/src/fill_GUI.m	(revision 605)
+++ /trunk/src/fill_GUI.m	(revision 606)
@@ -28,17 +28,17 @@
         if isfield(handles,fields{ifield})
             set(handles.(fields{ifield}),'Visible','on')
-%             children=get(handles.(fields{ifield}),'children');
-%             for ichild=1:numel(children)
-%                 hchild.(get(children(ichild),'tag'))=children(ichild);
-%             end
-         %   errormsg=fill_GUI(Param.(fields{ifield}),hchild);% apply the function to the substructure
-         errormsg=fill_GUI(Param.(fields{ifield}),handles.(fields{ifield}));% apply the function to the substructure
-           % if the input sub-structure fits with a tag name of the GUI and a
-         % substructure of UserData
+            %             children=get(handles.(fields{ifield}),'children');
+            %             for ichild=1:numel(children)
+            %                 hchild.(get(children(ichild),'tag'))=children(ichild);
+            %             end
+            %   errormsg=fill_GUI(Param.(fields{ifield}),hchild);% apply the function to the substructure
+            errormsg=fill_GUI(Param.(fields{ifield}),handles.(fields{ifield}));% apply the function to the substructure
+            % if the input sub-structure fits with a tag name of the GUI and a
+            % substructure of UserData
         elseif isfield(UserData,fields{ifield})&& isfield(handles,fields{ifield})&&isfield(Param.(fields{ifield}),'Name')
             UserData.(fields{ifield})=Param.(fields{ifield});
-            set(handles.(fields{ifield}),'String',Param.(fields{ifield}).Name) 
+            set(handles.(fields{ifield}),'String',Param.(fields{ifield}).Name)
         end
-    % case of an element
+        % case of an element
     else
         hh=[];
@@ -55,6 +55,6 @@
                 check_done=1;
             end
-        elseif isnumeric(input_data) 
-            if numel(input_data)>1 
+        elseif isnumeric(input_data)
+            if numel(input_data)>1
                 %deals with array displayed in multiple boxes labeled by an index
                 for ibox=1:numel(input_data)
@@ -64,50 +64,52 @@
                 end
             else % single box (usual case)
-               if isfield(handles,['num_' fields{ifield}])
-                   hh=handles.(['num_' fields{ifield}]);
-               end
+                if isfield(handles,['num_' fields{ifield}])
+                    hh=handles.(['num_' fields{ifield}]);
+                end
             end
         end
         for ibox=1:numel(hh)
-        if ~isempty(hh(ibox))&& ~check_done
-            set(hh(ibox),'Visible','on')
-%             input_data
-            switch get(hh(ibox),'Style')
-                case {'checkbox','radiobutton','togglebutton'}
-                    if isnumeric(input_data)
-                        set(hh(ibox),'Value',input_data(ibox))
+            if ~isempty(hh(ibox))&& ~check_done
+                set(hh(ibox),'Visible','on')
+                %             input_data
+                if isfield(hh(ibox),'Style')
+                    switch get(hh(ibox),'Style')
+                        case {'checkbox','radiobutton','togglebutton'}
+                            if isnumeric(input_data)
+                                set(hh(ibox),'Value',input_data(ibox))
+                            end
+                        case 'edit'
+                            input_string='';
+                            if isnumeric(input_data)
+                                if numel(input_data)>0
+                                    input_string=num2str(input_data(ibox));
+                                end
+                            else
+                                input_string=input_data;
+                            end
+                            set(hh(ibox),'String',input_string)
+                        case{'listbox','popupmenu'}
+                            if isnumeric(input_data)
+                                input_data=num2str(input_data);
+                            end
+                            menu=get(hh(ibox),'String');
+                            if ischar(input_data)
+                                input_data={input_data};
+                            end
+                            values=zeros(size(input_data));
+                            for idata=1:numel(input_data)
+                                iline=find(strcmp(input_data{idata},menu));
+                                if isempty(iline)
+                                    values(idata)=1;
+                                    menu=[input_data(idata);menu];
+                                else
+                                    values(idata)=iline(1);
+                                end
+                            end
+                            set(hh(ibox),'String',menu)
+                            set(hh(ibox),'Value',values)
                     end
-                case 'edit'
-                    input_string='';
-                    if isnumeric(input_data)
-                        if numel(input_data)>0
-                        input_string=num2str(input_data(ibox));
-                        end
-                    else
-                        input_string=input_data;
-                    end
-                    set(hh(ibox),'String',input_string)
-                case{'listbox','popupmenu'}
-                    if isnumeric(input_data)
-                        input_data=num2str(input_data);
-                    end
-                    menu=get(hh(ibox),'String');
-                    if ischar(input_data)
-                        input_data={input_data};
-                    end
-                    values=zeros(size(input_data));
-                    for idata=1:numel(input_data)
-                        iline=find(strcmp(input_data{idata},menu));
-                        if isempty(iline)
-                            values(idata)=1;
-                            menu=[input_data(idata);menu];
-                        else
-                            values(idata)=iline(1);
-                        end
-                    end
-                    set(hh(ibox),'String',menu)
-                    set(hh(ibox),'Value',values)
+                end
             end
-        end
         end
     end
Index: /trunk/src/get_field.m
===================================================================
--- /trunk/src/get_field.m	(revision 605)
+++ /trunk/src/get_field.m	(revision 606)
@@ -367,5 +367,5 @@
 for icell=1:numel(CellInfo) 
     VarIndex=CellInfo{icell}.VarIndex;
-    if ~isempty(find(VarIndex==yindex,1)) && (isempty(VarRole{icell}.coord_x)||~isequal(VarRole{icell}.coord_x,VarIndex))
+    if ~isempty(find(VarIndex==yindex,1)) && (isempty(CellInfo{icell}.VarIndex_coord_x)||~isequal(CellInfo{icell}.VarIndex_coord_x,VarIndex))
         cell_select=icell;
         break
@@ -374,7 +374,7 @@
 val=get(handles.abscissa,'Value');
 set(handles.abscissa,'Value',min(val,2));
-coord_x_index=VarRole{cell_select}.coord;
+coord_x_index=CellInfo{cell_select}.VarIndex_coord_x;
 coord_x_index=coord_x_index(coord_x_index~=0);
-set(handles.XVarname,'String',[{''}; (Field.ListVarName(coord_x_index))'; (Field.ListVarName(VarIndex))'])
+set(handles.XVarName,'String',[{''}; (Field.ListVarName(coord_x_index))'; (Field.ListVarName(VarIndex))'])
 
 %------------------------------------------------------------------------
Index: /trunk/src/series.m
===================================================================
--- /trunk/src/series.m	(revision 605)
+++ /trunk/src/series.m	(revision 606)
@@ -258,59 +258,57 @@
 function MenuBrowse_Callback(hObject, eventdata, handles)
 %------------------------------------------------------------------------   
+%get the previous input file in the Input Table
+oldfile=''; %default
 InputTable=get(handles.InputTable,'Data');
-if isempty(InputTable)
-    RootPathCell={};
-else
-    RootPathCell=InputTable(:,1);
-end
-oldfile=''; %default
-if isempty(RootPathCell)||isequal(RootPathCell,{''})%loads the previously stored file name and set it as default in the file_input box
-     dir_perso=prefdir;
-     profil_perso=fullfile(dir_perso,'uvmat_perso.mat');
-     if exist(profil_perso,'file')
-          h=load (profil_perso);
-         if isfield(h,'filebase')&&ischar(h.filebase)
-                 oldfile=h.filebase;
-         end
-         if isfield(h,'RootPath')&&ischar(h.RootPath) 
-                 oldfile=h.RootPath;
-         end
-     end
-else
-     SubDirCell=InputTable(:,2);
-    RootFileCell=InputTable(:,3);
-     oldfile=fullfile(RootPathCell{1},SubDirCell{1},RootFileCell{1});
- end
-[FileName, PathName] = uigetfile( ...
-       {'*.xml;*.xls;*.png;*.tif;*.avi;*.AVI;*.nc', ' (*.xml,*.xls, *.png,*.tif, *.avi,*.nc)';
-       '*.xml',  '.xml files '; ...
-        '*.xls',  '.xls files '; ...
-        '*.png','.png image files'; ...
-        '*.tif','.tif image files'; ...
-        '*.avi;*.AVI','.avi movie files'; ...
-        '*.nc','.netcdf files'; ...
-        '*.*',  'All Files (*.*)'}, ...
-        'Pick a file',oldfile);
-fileinput=[PathName FileName];%complete file name 
-if isempty(fileinput),return;end %abandon if no file is introduced by the browser
-[path,name,ext]=fileparts(fileinput);
-if isequal(ext,'.xml')
-    [Param,Heading]=xml2struct(fileinput);
-    if ~strcmp(Heading,'Series')
-        msg_box_uvmat('ERROR','xml file heading is not <Series>')
-    else
-        fill_GUI(Param,handles.series);%fill the GUI with the parameters retrieved from the xml file
-        if isfield(Param,'CheckObject')&& Param.CheckObject
-            set_object(Param.ProjObject)
-        end
-        set(handles.REFRESH,'UserData',1:size(Param.InputTable,1))
-        REFRESH_Callback([],[], handles)
-        return
-    end
-elseif isequal(ext,'.xls')
-    msg_box_uvmat('ERROR','input file type not implemented')%A Faire: ouvrir le fichier pour naviguer
-else
+if isequal(InputTable(:,1),[{''};{''};{''};{''}])%open the personal file for empty previous input
+    dir_perso=prefdir;
+    profil_perso=fullfile(dir_perso,'uvmat_perso.mat');
+    if exist(profil_perso,'file')
+         h=load (profil_perso);
+        if isfield(h,'RootPath')&&ischar(h.RootPath)
+            oldfile=h.RootPath;
+        end
+    end
+else% select the previous file as the first line of the input table
+    oldfile=fullfile(InputTable{1,1},InputTable{1,2},InputTable{1,3});
+end
+hfig=uigetfile_uvmat('file browser',fileparts(fileparts(oldfile)));
+uiwait(hfig);
+if ishandle(hfig) % stop if browser closed without selection
+    fileinput=get(hfig,'UserData');% retrieve the input file selection
+    delete(hfig)
     display_file_name(handles,fileinput,0)
 end
+% 
+% [FileName, PathName] = uigetfile( ...
+%        {'*.xml;*.xls;*.png;*.tif;*.avi;*.AVI;*.nc', ' (*.xml,*.xls, *.png,*.tif, *.avi,*.nc)';
+%        '*.xml',  '.xml files '; ...
+%         '*.xls',  '.xls files '; ...
+%         '*.png','.png image files'; ...
+%         '*.tif','.tif image files'; ...
+%         '*.avi;*.AVI','.avi movie files'; ...
+%         '*.nc','.netcdf files'; ...
+%         '*.*',  'All Files (*.*)'}, ...
+%         'Pick a file',oldfile);
+% fileinput=[PathName FileName];%complete file name 
+% [path,name,ext]=fileparts(fileinput);
+% if isequal(ext,'.xml')
+%     [Param,Heading]=xml2struct(fileinput);
+%     if ~strcmp(Heading,'Series')
+%         msg_box_uvmat('ERROR','xml file heading is not <Series>')
+%     else
+%         fill_GUI(Param,handles.series);%fill the GUI with the parameters retrieved from the xml file
+%         if isfield(Param,'CheckObject')&& Param.CheckObject
+%             set_object(Param.ProjObject)
+%         end
+%         set(handles.REFRESH,'UserData',1:size(Param.InputTable,1))
+%         REFRESH_Callback([],[], handles)
+%         return
+%     end
+% elseif isequal(ext,'.xls')
+%     msg_box_uvmat('ERROR','input file type not implemented')%A Faire: ouvrir le fichier pour naviguer
+% else
+%     display_file_name(handles,fileinput,0)
+% end
 
 % --------------------------------------------------------------------
@@ -2006,4 +2004,9 @@
 end
 set(handles.FieldTransform,'Visible',FieldTransformVisible)
+if isfield(ParamOut,'TransformPath')
+    set(handles.ActionExt,'UserData',ParamOut.TransformPath)
+else
+    set(handles.ActionExt,'UserData',[])
+end
 
 %% Visibility of projection object
@@ -2227,49 +2230,53 @@
 function CheckObject_Callback(hObject, eventdata, handles)
 %------------------------------------------------------------------------
+hset_object=findobj(allchild(0),'tag','set_object');%find the set_object interface handle
 value=get(handles.CheckObject,'Value');
 if value
-%      set(handles.CheckObject,'BackgroundColor',[1 1 0])%put unactivated buttons to yellow
-     hset_object=findobj(allchild(0),'tag','set_object');%find the set_object interface handle
-     if ishandle(hset_object)
-         uistack(hset_object,'top')% show the GUI set_object if opened
-     else
-         %get the object file 
-         InputTable=get(handles.InputTable,'Data');
-         defaultname=InputTable{1,1};
-         if isempty(defaultname)
-            defaultname={''};
-         end
-        [FileName, PathName] = uigetfile( ...
-       {'*.xml;*.mat', ' (*.xml,*.mat)';
-       '*.xml',  '.xml files '; ...
-        '*.mat',  '.mat matlab files '}, ...
-        'Pick an xml object file (or use uvmat to create it)',defaultname);
-        fileinput=[PathName FileName];%complete file name 
-        sizf=size(fileinput);
-        if (~ischar(fileinput)||~isequal(sizf(1),1)),return;end
-        %read the file
-        data=xml2struct(fileinput);
-        if ~isfield(data,'Type')
-             msgbox_uvmat('ERROR',[fileinput ' is not an object xml file'])
-             return
-        end
-        if ~isfield(data,'ProjMode')
-             data.ProjMode='none';
-        end
-        hset_object=set_object(data);% call the set_object interface
-     end 
-     ProjObject=read_GUI(hset_object);
-     set(handles.ProjObject,'String',ProjObject.Name);%display the object name
-     SeriesData=get(handles.series,'UserData');
-     SeriesData.ProjObject=ProjObject;
-     set(handles.series,'UserData',SeriesData);
-     set(handles.DeleteObject,'Visible','on');
-     set(handles.ViewObject,'Visible','on');
-     set(handles.ProjObject,'Visible','on');
+    SeriesData=get(handles.series,'UserData');
+    if ~(isfield(SeriesData,'ProjObject')&&~isempty(SeriesData.ProjObject))
+        if ishandle(hset_object)
+            uistack(hset_object,'top')% show the GUI set_object if opened
+        else
+            %get the object file
+            InputTable=get(handles.InputTable,'Data');
+            defaultname=InputTable{1,1};
+            if isempty(defaultname)
+                defaultname={''};
+            end
+            [FileName, PathName] = uigetfile( ...
+                {'*.xml;*.mat', ' (*.xml,*.mat)';
+                '*.xml',  '.xml files '; ...
+                '*.mat',  '.mat matlab files '}, ...
+                'Pick an xml object file (or use uvmat to create it)',defaultname);
+            fileinput=[PathName FileName];%complete file name
+            sizf=size(fileinput);
+            if (~ischar(fileinput)||~isequal(sizf(1),1)),return;end
+            %read the file
+            data=xml2struct(fileinput);
+            if ~isfield(data,'Type')
+                msgbox_uvmat('ERROR',[fileinput ' is not an object xml file'])
+                return
+            end
+            if ~isfield(data,'ProjMode')
+                data.ProjMode='none';
+            end
+            hset_object=set_object(data);% call the set_object interface
+        end
+        ProjObject=read_GUI(hset_object);
+        set(handles.ProjObject,'String',ProjObject.Name);%display the object name
+        SeriesData=get(handles.series,'UserData');
+        SeriesData.ProjObject=ProjObject;
+        set(handles.series,'UserData',SeriesData);
+    end
+    set(handles.DeleteObject,'Visible','on');
+    set(handles.ViewObject,'Visible','on');
+    set(handles.ProjObject,'Visible','on');
 else
-         set(handles.DeleteObject,'Visible','off');
-     set(handles.ViewObject,'Visible','off');
-     set(handles.ProjObject,'Visible','off');
-%     set(handles.CheckObject,'BackgroundColor',[0.7 0.7 0.7])%put activated buttons to green
+    set(handles.DeleteObject,'Visible','off');
+    set(handles.ViewObject,'Visible','off');
+    if ~ishandle(hset_object)
+    set(handles.ViewObject,'Value',0);
+    end
+    set(handles.ProjObject,'Visible','off');
 end
 %set(handles.series,'UserData',SeriesData)
@@ -2465,5 +2472,5 @@
         uicontrol('Style','frame','Units','normalized', 'Position', [0.05 0.81 0.9 0.05]);
         uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.7 0.01 0.2 0.07],'String','Close','FontWeight','bold','FontUnits','points','FontSize',11,'Callback',@stop_status);
-        hrefresh=uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.1 0.01 0.2 0.07],'String','Refresh','FontWeight','bold','FontUnits','points','FontSize',11,'Callback',@refresh_GUI);
+        uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.1 0.01 0.2 0.07],'String','Refresh','FontWeight','bold','FontUnits','points','FontSize',11,'Callback',@refresh_GUI);
         %set(hrefresh,'UserData',StatusData)
         BarPosition=[0.05 0.81 0.01 0.05];
@@ -2471,5 +2478,5 @@
         drawnow
     end
-    refresh_GUI(hrefresh,[]) 
+    refresh_GUI(hfig) 
 else
     %% delete current display fig if selection is off
@@ -2526,7 +2533,6 @@
 %------------------------------------------------------------------------   
 % launched by refreshing the status figure
-function refresh_GUI(hObject, eventdata)
-%------------------------------------------------------------------------
-hfig=get(hObject,'parent');
+function refresh_GUI(hfig)
+%------------------------------------------------------------------------
 htitlebox=findobj(hfig,'tag','titlebox');
 hlist=findobj(hfig,'tag','list');
@@ -2556,4 +2562,5 @@
 ListDisplay=ListDisplay(datnum~=0);
 datnum=datnum(datnum~=0);%keep the non zero values corresponding to existing files
+NbOutputFile=[];
 if isempty(datnum)
     if testrecent
@@ -2676,29 +2683,45 @@
 ActionList=get(handles.ActionName,'String');
 ActionName=ActionList{get(handles.ActionName,'Value')};
+TransformPath='';
+if ~isempty(get(handles.ActionExt,'UserData'))
+    TransformPath=get(handles.ActionExt,'UserData');
+end
 if strcmp(ActionExt,'.sh')
+    set(handles.ActionExt,'BackgroundColor',[1 1 0])
     ActionFullName=fullfile(get(handles.ActionPath,'String'),[ActionName '.sh']);
     if ~exist(ActionFullName,'file')
         answer=msgbox_uvmat('INPUT_Y-N','compiled version has not been created: compile now?');
         if strcmp(answer,'Yes')
+            set(handles.ActionExt,'BackgroundColor',[1 1 0])
+            path_uvmat=fileparts(which('series'));
             currentdir=pwd;
-            cd(get(handles.ActionPath,'String'))
-            compile(ActionName)
+            cd(get(handles.ActionPath,'String'))% go to the directory of Action
+            %  addpath(get(handles.TransformPath,'String'))
+            addpath(path_uvmat)% add the path to uvmat to run the fct 'compile'
+           % addpath(fullfile(path_uvmat,'transform_field'))% add the path to uvmat to run the fct 'compile'
+            compile(ActionName,TransformPath)
             cd(currentdir)
         end
-    end
-    sh_file_info=dir(fullfile(get(handles.ActionPath,'String'),[ActionName '.sh']));
-    m_file_info=dir(fullfile(get(handles.ActionPath,'String'),[ActionName '.m']));
-    if isfield(m_file_info,'datenum') && m_file_info.datenum>sh_file_info.datenum
-        set(handles.ActionExt,'BackgroundColor',[1 1 0])
-        drawnow
-        answer=msgbox_uvmat('INPUT_Y-N',[ActionName '.sh needs to be updated: recompile now?']);
-        if strcmp(answer,'Yes')
-            currentdir=pwd;
-            cd(get(handles.ActionPath,'String'))
-            compile(ActionName)
-            cd(currentdir)
-        end
-        set(handles.ActionExt,'BackgroundColor',[1 1 1])
-    end
+        
+    else
+        sh_file_info=dir(fullfile(get(handles.ActionPath,'String'),[ActionName '.sh']));
+        m_file_info=dir(fullfile(get(handles.ActionPath,'String'),[ActionName '.m']));
+        if isfield(m_file_info,'datenum') && m_file_info.datenum>sh_file_info.datenum
+            set(handles.ActionExt,'BackgroundColor',[1 1 0])
+            drawnow
+            answer=msgbox_uvmat('INPUT_Y-N',[ActionName '.sh needs to be updated: recompile now?']);
+            if strcmp(answer,'Yes')
+                path_uvmat=fileparts(which('series'));
+                currentdir=pwd;
+                cd(get(handles.ActionPath,'String'))% go to the directory of Action
+                %  addpath(get(handles.TransformPath,'String'))
+                addpath(path_uvmat)% add the path to uvmat to run the fct 'compile'
+                addpath(fullfile(path_uvmat,'transform_field'))% add the path to uvmat to run the fct 'compile'
+                compile(ActionName,TransformPath)
+                cd(currentdir)
+            end
+        end
+    end
+    set(handles.ActionExt,'BackgroundColor',[1 1 1])
 end
 
@@ -2717,4 +2740,5 @@
     set(handles.DeleteObject,'Visible','off')
     set(handles.ViewObject,'Visible','off')
+    set(handles.DeleteObject,'Value',0)
 end
 
Index: /trunk/src/series/civ_series.m
===================================================================
--- /trunk/src/series/civ_series.m	(revision 605)
+++ /trunk/src/series/civ_series.m	(revision 606)
@@ -42,18 +42,21 @@
 path_series=fileparts(which('series'));
 addpath(fullfile(path_series,'series'))
-%% set the input elements needed on the GUI series when the action is selected in the menu ActionName
+%% set the input elements needed on the GUI series when the action is selected in the menu ActionName or InputTable refreshed
 if isstruct(Param) && isequal(Param.Action.RUN,0)
     Data=civ_input(Param);% introduce the civ parameters using the GUI civ_input
-    Data.Program=mfilename;
-    Data.AllowInputSort='off';...% allow alphabetic sorting of the list of input file SubDir (options 'off'/'on', 'off' by default)
-        Data.WholeIndexRange='off';...% prescribes the file index ranges from min to max (options 'off'/'on', 'off' by default)
-        Data.NbSlice='off'; ...%nbre of slices ('off' by default)
-        Data.VelType='off';...% menu for selecting the velocity type (options 'off'/'one'/'two',  'off' by default)
-        Data.FieldName='off';...% menu for selecting the field (s) in the input file(options 'off'/'one'/'two', 'off' by default)
-        Data.FieldTransform = 'off';...%can use a transform function
-        Data.ProjObject='off';...%can use projection object(option 'off'/'on',
-        Data.Mask='off';...%can use mask option   (option 'off'/'on', 'off' by default)
-        Data.OutputDirExt='.civ';%set the output dir extension
-       
+    Data.Program=mfilename;%gives the name of the current function
+    Data.AllowInputSort='off';% allow alphabetic sorting of the list of input file SubDir (options 'off'/'on', 'off' by default)
+    Data.WholeIndexRange='off';% prescribes the file index ranges from min to max (options 'off'/'on', 'off' by default)
+    Data.NbSlice='off'; %nbre of slices ('off' by default)
+    Data.VelType='off';% menu for selecting the velocity type (options 'off'/'one'/'two',  'off' by default)
+    Data.FieldName='off';% menu for selecting the field (s) in the input file(options 'off'/'one'/'two', 'off' by default)
+    Data.FieldTransform = 'off';%can use a transform function
+    Data.ProjObject='off';%can use projection object(option 'off'/'on',
+    Data.Mask='off';%can use mask option   (option 'off'/'on', 'off' by default)
+    Data.OutputDirExt='.civ';%set the output dir extension
+    filecell=get_file_series(Param);%check existence of the first input file
+    if ~exist(filecell{1,1},'file')
+        msgbox_uvmat('WARNING','the first input file does not exist')
+    end
     return
 end
@@ -115,5 +118,4 @@
     
     NbField=numel(i1_series_Civ1);
-    ImageTypeOptions={'image','multimage','mmreader','video'};
     [FileType_A,FileInfo,MovieObject_A]=get_file_type(filecell{1,1});
     FileType_B=FileType_A;
@@ -121,5 +123,4 @@
     if size(filecell,1)>=2 && ~strcmp(filecell{1,1},filecell{2,1})
         [FileType_B,FileInfo,MovieObject_B]=get_file_type(filecell{2,1});
-        CheckImage_B=~isempty(find(strcmp(FileType,ImageTypeOptions)));% =1 for images
     end
 end
@@ -141,8 +142,23 @@
 check_patch1=0;%default
 
-
-
-
-
+%% get timing from the ImaDoc file or input video
+[XmlData,NbSlice_calib,time,errormsg]=read_multimadoc(RootPath,SubDir,RootFile,FileExt,i1_series,i2_series,j1_series,j2_series);
+%TODO: get time_A and time_B
+% case of movies TODO TODO TODO
+if isempty(time) && (strcmp(FileType,'video') || strcmp(FileType,'mmreader'))
+    set(handles.ListPairMode,'Value',1);
+    dt=1/get(MovieObject,'FrameRate');%time interval between successive frames
+    if strcmp(NomTypeIma,'*')
+        set(handles.ListPairMode,'String',{'series(Di)'})
+        MaxIndex_i=get(MovieObject,'NumberOfFrames');
+        time=(dt*(0:MaxIndex_i-1))';%list of image times
+    else
+        set(handles.ListPairMode,'String',[{'series(Dj)'};{'series(Di)'}])
+        MaxIndex_i=max(i1_series(i1_series>0));
+        MaxIndex_j=get(MovieObject,'NumberOfFrames');
+        time=ones(MaxIndex_i,1)*(dt*(0:MaxIndex_j-1));%list of image times
+        enable_j(handles,'on')
+    end
+    TimeUnit='s';
 %%%%% MAIN LOOP %%%%%%
 
@@ -164,22 +180,8 @@
             end
         else
-            %         if ~isfield(Param.Civ1,'ImageA')
             ImageName_A=fullfile_uvmat(RootPath,SubDir,RootFile,FileExt,NomType,i1_series_Civ1(ifield),[],j1_series_Civ1(ifield));
             [par_civ1.ImageA,MovieObject_A] = read_image(ImageName_A,FileType_A,MovieObject_A,FrameIndex_A_Civ1(ifield));
-            %         elseif ischar(Param.Civ1.ImageA)
-            %             Param.Civ1.ImageA=regexprep(Param.Civ1.ImageA,'''','\');
-            %             [par_civ1.ImageA,VideoObject] = read_image(Param.Civ1.ImageA,par_civ1.FileTypeA,MovieObject_A,par_civ1.FrameIndexA);
-            %         end
-            %         if ~isfield(Param.Civ1,'ImageB')
             ImageName_B=fullfile_uvmat(RootPath,SubDir,RootFile,FileExt,NomType,i2_series_Civ1(ifield),[],j2_series_Civ1(ifield));
             [par_civ1.ImageB,MovieObject_B] = read_image(ImageName_B,FileType_B,MovieObject_B,FrameIndex_B_Civ1(ifield));
-            %         elseif isfield(Param.Civ1,'ImageB')&& ischar(Param.Civ1.ImageB)
-            %              Param.Civ1.ImageB=regexprep(Param.Civ1.ImageB,'''','\');
-            %              if strcmp(Param.Civ1.ImageA,Param.Civ1.ImageB)% use the same movie object
-            %                  [par_civ1.ImageB,VideoObject] = read_image(Param.Civ1.ImageB,par_civ1.FileTypeB,VideoObject,par_civ1.FrameIndexB);
-            %              else
-            %             [par_civ1.ImageB,VideoObject] = read_image(Param.Civ1.ImageB,par_civ1.FileTypeB,par_civ1.ImageB,par_civ1.FrameIndexB);
-            %              end
-            %         end
         end
         ncfile=fullfile_uvmat(RootPath,OutputDir,RootFile,'.nc',NomTypeNc,i1_series_Civ1(ifield),i2_series_Civ1(ifield),...
@@ -188,10 +190,13 @@
         par_civ1.ImageHeight=FileInfo.Height;
         list_param=(fieldnames(Param.ActionInput.Civ1))';
-        Civ1_param=list_param;%default
-        
-        %set the values of all the global attributes in list_param  
+        Civ1_param=regexprep(list_param,'^.+','Civ1_$0');% insert 'Civ1_' before  each string in list_param
+        Civ1_param=[{'Civ1_ImageA','Civ1_ImageB','Civ1_Time','Civ1_Dt'} Civ1_param]; %insert the names of the two input images
+        %indicate the values of all the global attributes in the output data 
+        Data.Civ1_ImageA=ImageName_A;
+        Data.Civ1_ImageB=ImageName_B;
+        Data.Civ1_Time=((time(i2_civ1(ifile)+1,j2_civ1(j)+1)+time(i1_civ1(ifile)+1,j1_civ1(j)+1))/2);
+        Data.Civ1_Dt=(time(i2_civ1(ifile)+1,j2_civ1(j)+1)-time(i1_civ1(ifile)+1,j1_civ1(j)+1));
         for ilist=1:length(list_param)
-            Civ1_param{ilist}=['Civ1_' list_param{ilist}];
-            Data.(['Civ1_' list_param{ilist}])=Param.ActionInput.Civ1.(list_param{ilist});
+            Data.(Civ1_param{4+ilist})=Param.ActionInput.Civ1.(list_param{ilist});
         end
         Data.ListGlobalAttribute=[Data.ListGlobalAttribute Civ1_param];
@@ -391,10 +396,6 @@
         ibx2=ceil(par_civ2.CorrBoxSize(1)/2);
         iby2=ceil(par_civ2.CorrBoxSize(2)/2);
-        %     isx2=ibx2+4;% search ara +-4 pixels around the guess
-        %     isy2=iby2+4;
         par_civ2.SearchBoxSize(1)=2*ibx2+9;% search ara +-4 pixels around the guess
         par_civ2.SearchBoxSize(2)=2*iby2+9;
-        %par_civ2.SearchBoxSize(1)=2*isx2+1;
-        %par_civ2.SearchBoxSize(2)=2*isy2+1;
         par_civ2.SearchBoxShift=[Shiftx(nbval>=1)./nbval(nbval>=1) Shifty(nbval>=1)./nbval(nbval>=1)];
         par_civ2.Grid=[GridX(nbval>=1)-par_civ2.SearchBoxShift(:,1)/2 GridY(nbval>=1)-par_civ2.SearchBoxShift(:,2)/2];% grid taken at the extrapolated origin of the displacement vectors
@@ -409,22 +410,16 @@
 
         list_param=(fieldnames(Param.ActionInput.Civ2))';
-        list_remove={'pxcmx','pxcmy','npx','npy','gridflag','maskflag','term_a','term_b','T0'};
-        for ilist=1:length(list_remove)
-            index=strcmp(list_remove{ilist},list_param);
-            if ~isempty(find(index,1))
-                list_param(index)=[];
-            end
-        end
+        Civ2_param=regexprep(list_param,'^.+','Civ2_$0');% insert 'Civ2_' before  each string in list_param
+        Civ2_param=[{'Civ2_ImageA','Civ2_ImageB','Civ2_Time','Civ2_Dt'} Civ2_param]; %insert the names of the two input images
+        %indicate the values of all the global attributes in the output data 
+        Data.Civ2_ImageA=ImageName_A;
+        Data.Civ2_ImageB=ImageName_B;
+        Data.Civ2_Time=1;
+        Data.Civ2_Dt=1;
         for ilist=1:length(list_param)
-            Civ2_param{ilist}=['Civ2_' list_param{ilist}];
-            eval(['Data.Civ2_' list_param{ilist} '=Param.ActionInput.Civ2.' list_param{ilist} ';'])
-        end
-        if isfield(Data,'Civ2_gridname') && strcmp(Data.Civ1_gridname(1:6),'noFile')
-            Data.Civ1_gridname='';
-        end
-        if isfield(Data,'Civ2_maskname') && strcmp(Data.Civ1_maskname(1:6),'noFile')
-            Data.Civ2_maskname='';
-        end
-        Data.ListGlobalAttribute=[Data.ListGlobalAttribute Civ2_param {'Civ2_Time','Civ2_Dt'}];
+            Data.(Civ2_param{4+ilist})=Param.ActionInput.Civ2.(list_param{ilist});
+        end
+        Data.ListGlobalAttribute=[Data.ListGlobalAttribute Civ2_param];
+        
         nbvar=numel(Data.ListVarName);
         Data.ListVarName=[Data.ListVarName {'Civ2_X','Civ2_Y','Civ2_U','Civ2_V','Civ2_F','Civ2_C'}];%  cell array containing the names of the fields to record
Index: /trunk/src/series/ima_levels.m
===================================================================
--- /trunk/src/series/ima_levels.m	(revision 605)
+++ /trunk/src/series/ima_levels.m	(revision 606)
@@ -43,5 +43,5 @@
 function ParamOut=ima_levels (Param)
 
-%% set the input elements needed on the GUI series when the action is selected in the menu ActionName
+%% set the input elements needed on the GUI series when the action is selected in the menu ActionName or InputTable refreshed
 if isstruct(Param) && isequal(Param.Action.RUN,0)
     ParamOut.NbViewMax=1;% max nbre of input file series (default , no limitation)
@@ -58,5 +58,7 @@
     %check the type of the existence and type of the first input file:
     Param.IndexRange.last_i=Param.IndexRange.first_i;%keep only the first index in the series
+    if isfield(Param.IndexRange,'first_j')
     Param.IndexRange.last_j=Param.IndexRange.first_j;
+    end
     filecell=get_file_series(Param);
     if ~exist(filecell{1,1},'file')
@@ -73,4 +75,5 @@
 %%%%%%%%%%%% STANDARD PART (DO NOT EDIT) %%%%%%%%%%%%
 %% read input parameters from an xml file if input is a file name (batch mode)
+ParamOut=[]
 checkrun=1;
 if ischar(Param)
Index: /trunk/src/series/merge_proj.m
===================================================================
--- /trunk/src/series/merge_proj.m	(revision 605)
+++ /trunk/src/series/merge_proj.m	(revision 606)
@@ -41,14 +41,15 @@
 function ParamOut=merge_proj(Param)
 
-%% set the input elements needed on the GUI series when the function is selected in the menu ActionName
+%% set the input elements needed on the GUI series when the function is selected in the menu ActionName or InputTable refreshed
 if isstruct(Param) && isequal(Param.Action.RUN,0)
-    ParamOut.AllowInputSort='off';...% allow alphabetic sorting of the list of input file SubDir (options 'off'/'on', 'off' by default)
-    ParamOut.WholeIndexRange='on';...% prescribes the file index ranges from min to max (options 'off'/'on', 'off' by default)
-    ParamOut.NbSlice='off'; ...%nbre of slices ('off' by default)
-    ParamOut.VelType='one';...% menu for selecting the velocity type (options 'off'/'one'/'two',  'off' by default)
-    ParamOut.FieldName='one';...% menu for selecting the field (s) in the input file(options 'off'/'one'/'two', 'off' by default)
-    ParamOut.FieldTransform = 'on';...%can use a transform function
-    ParamOut.ProjObject='on';...%can use projection object(option 'off'/'on',
-    ParamOut.Mask='off';...%can use mask option   (option 'off'/'on', 'off' by default)
+    ParamOut.AllowInputSort='off';% allow alphabetic sorting of the list of input file SubDir (options 'off'/'on', 'off' by default)
+    ParamOut.WholeIndexRange='on';% prescribes the file index ranges from min to max (options 'off'/'on', 'off' by default)
+    ParamOut.NbSlice='off'; %nbre of slices ('off' by default)
+    ParamOut.VelType='one';% menu for selecting the velocity type (options 'off'/'one'/'two',  'off' by default)
+    ParamOut.FieldName='one';% menu for selecting the field (s) in the input file(options 'off'/'one'/'two', 'off' by default)
+    ParamOut.FieldTransform = 'on';%can use a transform function
+    ParamOut.TransformPath=fullfile(fileparts(which('uvmat')),'transform_field');% path to transform functions (needed for compilation only)
+    ParamOut.ProjObject='on';%can use projection object(option 'off'/'on',
+    ParamOut.Mask='off';%can use mask option   (option 'off'/'on', 'off' by default)
     ParamOut.OutputDirExt='.mproj';%set the output dir extension
     ParamOut.OutputFileMode='NbInput';% '=NbInput': 1 output file per input file index, '=NbInput_i': 1 file per input file index i, '=NbSlice': 1 file per slice
@@ -57,12 +58,10 @@
         msgbox_uvmat('WARNING','the first input file does not exist')
     elseif isequal(size(Param.InputTable,1),1) && ~isfield(Param,'ProjObject')
-         msgbox_uvmat('WARNING','a projection object of type plane needs to be introduced for merge_proj')
-    end
-return
+        msgbox_uvmat('WARNING','a projection object of type plane needs to be introduced for merge_proj')
+    end
+    return
 end
 
 %%%%%%%%%%%% STANDARD PART (DO NOT EDIT) %%%%%%%%%%%%
-
-
 %% read input parameters from an xml file if input is a file name (batch mode)
 checkrun=1;
@@ -72,9 +71,9 @@
 end
 
-ParamOut=Param; %default output
+ParamOut=[] %default output
 if ~isfield(Param,'InputFields')
     Param.InputFields.FieldName='';
 end
-OutputSubDir=[Param.OutputSubDir Param.OutputDirExt];% subdirectory for output files
+OutputDir=[Param.OutputSubDir Param.OutputDirExt];% subdirectory for output files
 
 %% root input file type
@@ -93,19 +92,17 @@
 % i1_series(iview,fileindex) expresses the same indices as a 1D array in file indices
 %%%%%%%%%%%%
-NbSlice=1;%default
-if isfield(Param.IndexRange,'NbSlice')&&~isempty(Param.IndexRange.NbSlice)
-    NbSlice=Param.IndexRange.NbSlice;
-end
-nbview=numel(i1_series);%number of input file series (lines in InputTable)
-nbfield_j=size(i1_series{1},1); %nb of fields for the j index (bursts or volume slices)
-nbfield_i=size(i1_series{1},2); %nb of fields for the i index
-nbfield=nbfield_j*nbfield_i; %total number of fields
-nbfield_i=floor(nbfield/NbSlice);%total number of  indexes in a slice (adjusted to an integer number of slices) 
-nbfield=nbfield_i*NbSlice; %total number of fields after adjustement
+% NbSlice=1;%default
+% if isfield(Param.IndexRange,'NbSlice')&&~isempty(Param.IndexRange.NbSlice)
+%     NbSlice=Param.IndexRange.NbSlice;
+% end
+NbView=numel(i1_series);%number of input file series (lines in InputTable)
+NbField_j=size(i1_series{1},1); %nb of fields for the j index (bursts or volume slices)
+NbField_i=size(i1_series{1},2); %nb of fields for the i index
+NbField=NbField_j*NbField_i; %total number of fields
 
 %determine the file type on each line from the first input file 
 ImageTypeOptions={'image','multimage','mmreader','video'};
 NcTypeOptions={'netcdf','civx','civdata'};
-for iview=1:nbview
+for iview=1:NbView
     if ~exist(filecell{iview,1}','file')
         displ_uvmat('ERROR',['the first input file ' filecell{iview,1} ' does not exist'],checkrun)
@@ -122,5 +119,4 @@
 end
 
-
 %% calibration data and timing: read the ImaDoc files
 [XmlData,NbSlice_calib,time,errormsg]=read_multimadoc(RootPath,SubDir,RootFile,FileExt,i1_series,i2_series,j1_series,j2_series);
@@ -133,11 +129,23 @@
 
 %% coordinate transform or other user defined transform
-transform_fct='';%default
+% transform_fct='';%default fct handle
+% if isfield(Param,'FieldTransform')&&~isempty(Param.FieldTransform.TransformName)
+%     if isdeployed
+%         transform_fct=Param.FieldTransform.TransformName;
+%         dd=phys([]);%activate phys for compilation
+%     else
+%         currentdir=pwd;
+%         cd(Param.FieldTransform.TransformPath)
+%         transform_fct=str2func(Param.FieldTransform.TransformName);
+%         cd (currentdir)
+%     end
+% end
+transform_fct='';%default fct handle
 if isfield(Param,'FieldTransform')&&~isempty(Param.FieldTransform.TransformName)
-    addpath(Param.FieldTransform.TransformPath)
-    transform_fct=str2func(Param.FieldTransform.TransformName);
-    rmpath(Param.FieldTransform.TransformPath)
-end
-
+        currentdir=pwd;
+        cd(Param.FieldTransform.TransformPath)
+        transform_fct=str2func(Param.FieldTransform.TransformName);
+        cd (currentdir)
+end
 %%%%%%%%%%%% END STANDARD PART  %%%%%%%%%%%%
  % EDIT FROM HERE
@@ -152,5 +160,5 @@
     return
 end
-for iview=1:nbview
+for iview=1:NbView
 	if ~isequal(CheckImage{iview},CheckImage{1})||~isequal(CheckNc{iview},CheckNc{1})
         displ_uvmat('ERROR','input set of input series: need  either netcdf either image series',checkrun)
@@ -169,175 +177,175 @@
 %% MAIN LOOP ON SLICES
 %%%%%%%%%%%%% STANDARD PART (DO NOT EDIT) %%%%%%%%%%%%
-for i_slice=1:NbSlice
-    index_slice=i_slice:NbSlice:nbfield;% select file indices of the slice
-    nbfiles=0;
-    nbmissing=0;
+% for i_slice=1:NbSlice
+%     index_slice=i_slice:NbSlice:NbField;% select file indices of the slice
+%     NbFiles=0;
+%     nbmissing=0;
 
     %%%%%%%%%%%%%%%% loop on field indices %%%%%%%%%%%%%%%%
-    for index=index_slice
-        if checkrun
-            stopstate=get(Param.RUNHandle,'BusyAction');
-            update_waitbar(Param.WaitbarHandle,index/nbfield)
-        else
-            stopstate='queue';
-        end
-        if ~isequal(stopstate,'queue')% enable STOP command
-            return
-        end
-        %%%%%%%%%%%%%%%% loop on views (input lines) %%%%%%%%%%%%%%%%
-        Data=cell(1,nbview);%initiate the set Data
-        nbtime=0;
-        for iview=1:nbview
-            %% reading input file(s)
-            [Data{iview},tild,errormsg] = read_field(filecell{iview,index},FileType{iview},Param.InputFields,frame_index{iview}(index));
+for index=1:NbField
+    if checkrun
+        stopstate=get(Param.RUNHandle,'BusyAction');
+        update_waitbar(Param.WaitbarHandle,index/NbField)
+    else
+        stopstate='queue';
+    end
+    if ~isequal(stopstate,'queue')% enable STOP command
+        return
+    end
+    %%%%%%%%%%%%%%%% loop on views (input lines) %%%%%%%%%%%%%%%%
+    Data=cell(1,NbView);%initiate the set Data
+    nbtime=0;
+    for iview=1:NbView
+        %% reading input file(s)
+        [Data{iview},tild,errormsg] = read_field(filecell{iview,index},FileType{iview},Param.InputFields,frame_index{iview}(index));
+        if ~isempty(errormsg)
+            errormsg=['merge_proj/read_field/' errormsg];
+            display(errormsg)
+            break
+        end
+        timeread(iview)=0;
+        if isfield(Data{iview},'Time')
+            timeread(iview)=Data{iview}.Time;
+            nbtime=nbtime+1;
+        end
+        if ~isempty(NbSlice_calib)
+            Data{iview}.ZIndex=mod(i1_series{iview}(index)-1,NbSlice_calib{iview})+1;%Zindex for phys transform
+        end
+
+        %% transform the input field (e.g; phys) if requested
+        if ~isempty(transform_fct)
+            if nargin(transform_fct)>=2
+                Data{iview}=transform_fct(Data{iview},XmlData{iview});
+            else
+                Data{iview}=transform_fct(Data{iview});
+            end
+        end
+%          Data{iview}=phys(Data{iview},XmlData{iview});
+        %% check whether tps is needed, then calculate tps coefficients if needed
+        check_tps=0;
+        if isfield(Param.InputFields,'FieldName')
+            if ischar(Param.InputFields.FieldName)
+                Param.InputFields.FieldName={Param.InputFields.FieldName};
+            end
+        else
+            Param.InputFields.FieldName={};
+        end
+        for ilist=1:numel(Param.InputFields.FieldName)
+            switch Param.InputFields.FieldName{ilist}
+                case {'vort','div','strain'}
+                    check_tps=1;
+            end
+        end
+
+        %% calculate tps coeff if needed
+        check_proj_tps= ~isempty(Param.ProjObject)&& strcmp(Param.ProjObject.ProjMode,'filter')&&~isfield(Data{iview},'Coord_tps');
+        Data{iview}=tps_coeff_field(Data{iview},check_proj_tps);
+
+        %% projection on object (gridded plane)
+        if Param.CheckObject
+            [Data{iview},errormsg]=proj_field(Data{iview},Param.ProjObject);
             if ~isempty(errormsg)
-                errormsg=['merge_proj/read_field/' errormsg];
-                display(errormsg)
-                break
-            end
-            timeread(iview)=0;
-            if isfield(Data{iview},'Time')
-                    timeread(iview)=Data{iview}.Time;
-                    nbtime=nbtime+1;
-                end
-            if ~isempty(NbSlice_calib)
-                Data{iview}.ZIndex=mod(i1_series{iview}(index)-1,NbSlice_calib{iview})+1;%Zindex for phys transform
-            end
-            
-            %% transform the input field (e.g; phys) if requested
-            if ~isempty(transform_fct)
-                if nargin(transform_fct)>=2
-                    Data{iview}=transform_fct(Data{iview},XmlData{iview});
-                else
-                    Data{iview}=transform_fct(Data{iview});
-                end
-            end
-            
-            %% check whether tps is needed, then calculate tps coefficients if needed
-            check_tps=0;
-            if isfield(Param.InputFields,'FieldName')
-                if ischar(Param.InputFields.FieldName)
-                    Param.InputFields.FieldName={Param.InputFields.FieldName};
-                end
-            else
-                Param.InputFields.FieldName={};
-            end
-            for ilist=1:numel(Param.InputFields.FieldName)
-                switch Param.InputFields.FieldName{ilist}
-                    case {'vort','div','strain'}
-                        check_tps=1;
-                end
-            end
-                
-            %% calculate tps coeff if needed
-             check_proj_tps= ~isempty(Param.ProjObject)&& strcmp(Param.ProjObject.ProjMode,'filter')&&~isfield(Data{iview},'Coord_tps');
-            Data{iview}=tps_coeff_field(Data{iview},check_proj_tps);
-
-            %% projection on object (gridded plane)
-            if Param.CheckObject
-                [Data{iview},errormsg]=proj_field(Data{iview},Param.ProjObject);
-                if ~isempty(errormsg)
-                    displ_uvmat('ERROR',['error in merge_proge/proj_field: ' errormsg],checkrun)
-                    return
-                end
-            end
-        end
-        %----------END LOOP ON VIEWS----------------------
-        
-        %% merge the nbview fields
-        MergeData=merge_field(Data);
-        if isfield(MergeData,'Txt')
-            displ_uvmat('ERROR',MergeData.Txt,checkrun)
-            return
-        end
-        
-        % time of the merged field:
-        if ~isempty(time)% time defined from ImaDoc
-            timeread=time(:,index);
-        end
-        timeread=mean(timeread);
-        
-        % generating the name of the merged field
-        i1=i1_series{iview}(index);
-        if ~isempty(i2_series{iview})
-            i2=i2_series{iview}(index);
-        else
-            i2=i1;
-        end
-        j1=1;
-        j2=1;
-        if ~isempty(j1_series{iview})
-            j1=j1_series{iview}(index);
-            if ~isempty(j2_series{iview})
-                j2=j2_series{iview}(index);
-            else
-                j2=j1;
-            end
-        end
-        OutputFile=fullfile_uvmat(RootPath{1},OutputSubDir,RootFile{1},FileExtOut,NomType{1},i1,i2,j1,j2);
-        
-        % recording the merged field
-        if CheckImage{1}    %in case of input images an image is produced
-            if isa(MergeData.A,'uint8')
-                bitdepth=8;
-            elseif isa(MergeData.A,'uint16')
-                bitdepth=16;
-            end
-            imwrite(MergeData.A,OutputFile,'BitDepth',bitdepth);
-            %write xml calibration file
-            siz=size(MergeData.A);
-            npy=siz(1);
-            npx=siz(2);
-            if isfield(MergeData,'VarAttribute')&&isfield(MergeData.VarAttribute{1},'Coord_2')&&isfield(MergeData.VarAttribute{1},'Coord_1')
-                Rangx=MergeData.VarAttribute{1}.Coord_2;
-                Rangy=MergeData.VarAttribute{1}.Coord_1;
-            elseif isfield(MergeData,'AX')&& isfield(MergeData,'AY')
-                Rangx=[MergeData.AX(1) MergeData.AX(end)];
-                Rangy=[MergeData.AY(1) MergeData.AY(end)];
-            else
-                Rangx=[0.5 npx-0.5];
-                Rangy=[npy-0.5 0.5];%default
-            end
-            pxcmx=(npx-1)/(Rangx(2)-Rangx(1));
-            pxcmy=(npy-1)/(Rangy(1)-Rangy(2));
-            T_x=-pxcmx*Rangx(1)+0.5;
-            T_y=-pxcmy*Rangy(2)+0.5;
-            GeometryCal.focal=1;
-            GeometryCal.R=[pxcmx,0,0;0,pxcmy,0;0,0,1];
-            GeometryCal.Tx_Ty_Tz=[T_x T_y 1];
-            ImaDoc.GeometryCalib=GeometryCal;
-%             t=struct2xml(ImaDoc);
-%             t=set(t,1,'name','ImaDoc');
-%             save(t,[filebase_merge '.xml'])
-%             display([filebase_merge '.xml saved'])
-        else
-            MergeData.ListGlobalAttribute={'Conventions','Project','InputFile_1','InputFile_end','nb_coord','nb_dim','dt','Time','civ'};
-            MergeData.Conventions='uvmat';
-            MergeData.nb_coord=2;
-            MergeData.nb_dim=2;
-            dt=[];
-            if isfield(Data{1},'dt')&& isnumeric(Data{1}.dt)
-                dt=Data{1}.dt;
-            end
-            for iview =2:numel(Data)
-                if ~(isfield(Data{iview},'dt')&& isequal(Data{iview}.dt,dt))
-                    dt=[];%dt not the same for all fields
-                end
-            end
-            if isempty(dt)
-                MergeData.ListGlobalAttribute(6)=[];
-            else
-                MergeData.dt=dt;
-            end
-            MergeData.Time=timeread;
-            error=struct2nc(OutputFile,MergeData);%save result file
-            if isempty(error)
-                display(['output file ' OutputFile ' written'])
-            else
-                display(error)
-            end
-        end
-    end
-end
+                displ_uvmat('ERROR',['error in merge_proge/proj_field: ' errormsg],checkrun)
+                return
+            end
+        end
+    end
+    %----------END LOOP ON VIEWS----------------------
+
+    %% merge the NbView fields
+    MergeData=merge_field(Data);
+    if isfield(MergeData,'Txt')
+        displ_uvmat('ERROR',MergeData.Txt,checkrun)
+        return
+    end
+
+    % time of the merged field:
+    if ~isempty(time)% time defined from ImaDoc
+        timeread=time(:,index);
+    end
+    timeread=mean(timeread);
+
+    % generating the name of the merged field
+    i1=i1_series{iview}(index);
+    if ~isempty(i2_series{iview})
+        i2=i2_series{iview}(index);
+    else
+        i2=i1;
+    end
+    j1=1;
+    j2=1;
+    if ~isempty(j1_series{iview})
+        j1=j1_series{iview}(index);
+        if ~isempty(j2_series{iview})
+            j2=j2_series{iview}(index);
+        else
+            j2=j1;
+        end
+    end
+    OutputFile=fullfile_uvmat(RootPath{1},OutputDir,RootFile{1},FileExtOut,NomType{1},i1,i2,j1,j2);
+
+    % recording the merged field
+    if CheckImage{1}    %in case of input images an image is produced
+        if isa(MergeData.A,'uint8')
+            bitdepth=8;
+        elseif isa(MergeData.A,'uint16')
+            bitdepth=16;
+        end
+        imwrite(MergeData.A,OutputFile,'BitDepth',bitdepth);
+        %write xml calibration file
+        siz=size(MergeData.A);
+        npy=siz(1);
+        npx=siz(2);
+        if isfield(MergeData,'VarAttribute')&&isfield(MergeData.VarAttribute{1},'Coord_2')&&isfield(MergeData.VarAttribute{1},'Coord_1')
+            Rangx=MergeData.VarAttribute{1}.Coord_2;
+            Rangy=MergeData.VarAttribute{1}.Coord_1;
+        elseif isfield(MergeData,'AX')&& isfield(MergeData,'AY')
+            Rangx=[MergeData.AX(1) MergeData.AX(end)];
+            Rangy=[MergeData.AY(1) MergeData.AY(end)];
+        else
+            Rangx=[0.5 npx-0.5];
+            Rangy=[npy-0.5 0.5];%default
+        end
+        pxcmx=(npx-1)/(Rangx(2)-Rangx(1));
+        pxcmy=(npy-1)/(Rangy(1)-Rangy(2));
+        T_x=-pxcmx*Rangx(1)+0.5;
+        T_y=-pxcmy*Rangy(2)+0.5;
+        GeometryCal.focal=1;
+        GeometryCal.R=[pxcmx,0,0;0,pxcmy,0;0,0,1];
+        GeometryCal.Tx_Ty_Tz=[T_x T_y 1];
+        ImaDoc.GeometryCalib=GeometryCal;
+        %             t=struct2xml(ImaDoc);
+        %             t=set(t,1,'name','ImaDoc');
+        %             save(t,[filebase_merge '.xml'])
+        %             display([filebase_merge '.xml saved'])
+    else
+        MergeData.ListGlobalAttribute={'Conventions','Project','InputFile_1','InputFile_end','nb_coord','nb_dim','dt','Time','civ'};
+        MergeData.Conventions='uvmat';
+        MergeData.nb_coord=2;
+        MergeData.nb_dim=2;
+        dt=[];
+        if isfield(Data{1},'dt')&& isnumeric(Data{1}.dt)
+            dt=Data{1}.dt;
+        end
+        for iview =2:numel(Data)
+            if ~(isfield(Data{iview},'dt')&& isequal(Data{iview}.dt,dt))
+                dt=[];%dt not the same for all fields
+            end
+        end
+        if isempty(dt)
+            MergeData.ListGlobalAttribute(6)=[];
+        else
+            MergeData.dt=dt;
+        end
+        MergeData.Time=timeread;
+        error=struct2nc(OutputFile,MergeData);%save result file
+        if isempty(error)
+            display(['output file ' OutputFile ' written'])
+        else
+            display(error)
+        end
+    end
+end
+
 
 %'merge_field': concatene fields
@@ -351,6 +359,6 @@
 MergeData=Data{1};%default
 error=0;
-nbview=length(Data);
-if nbview==1
+NbView=length(Data);
+if NbView==1
     return
 end
@@ -382,5 +390,5 @@
         for ivar=VarIndex
             VarName=MergeData.ListVarName{ivar};
-            for iview=1:nbview
+            for iview=1:NbView
                 MergeData.(VarName)=[MergeData.(VarName); Data{iview}.(VarName)];
             end
@@ -389,5 +397,5 @@
     else  
         testFF=0;
-        for iview=2:nbview
+        for iview=2:NbView
             for ivar=VarIndex
                 VarName=MergeData.ListVarName{ivar};
@@ -401,5 +409,5 @@
         end
         if testFF
-            nbaver=nbview-MergeData.FF;
+            nbaver=NbView-MergeData.FF;
             indgood=find(nbaver>0);
             for ivar=VarIndex
@@ -410,5 +418,5 @@
             for ivar=VarIndex
                 VarName=MergeData.ListVarName{ivar};
-                MergeData.(VarName)=double(MergeData.(VarName))./nbview;
+                MergeData.(VarName)=double(MergeData.(VarName))./NbView;
             end    
         end
Index: /trunk/src/series/time_series.m
===================================================================
--- /trunk/src/series/time_series.m	(revision 605)
+++ /trunk/src/series/time_series.m	(revision 606)
@@ -42,5 +42,5 @@
 function ParamOut=time_series(Param) 
 
-%% set the input elements needed on the GUI series when the action is selected in the menu ActionName
+%% set the input elements needed on the GUI series when the action is selected in the menu ActionName or InputTable refreshed
 if isstruct(Param) && isequal(Param.Action.RUN,0)
     ParamOut.AllowInputSort='off';% allow alphabetic sorting of the list of input file SubDir (options 'off'/'on', 'off' by default)
@@ -50,4 +50,5 @@
     ParamOut.FieldName='two';% menu for selecting the field (s) in the input file(options 'off'/'one'/'two', 'off' by default)
     ParamOut.FieldTransform = 'on';%can use a transform function
+    ParamOut.TransformPath=fullfile(fileparts(which('uvmat')),'transform_field');% path to transform functions (needed for compilation only)
     ParamOut.ProjObject='on';%can use projection object(option 'off'/'on',
     ParamOut.Mask='off';%can use mask option   (option 'off'/'on', 'off' by default)
@@ -71,5 +72,5 @@
 end
 
-ParamOut=Param; %default output
+ParamOut=[]; %default output
 OutputDir=[Param.OutputSubDir Param.OutputDirExt];
 
@@ -89,14 +90,12 @@
 % i1_series(iview,fileindex) expresses the same indices as a 1D array in file indices
 %%%%%%%%%%%%
-NbSlice=1;%default
-if isfield(Param.IndexRange,'NbSlice')&&~isempty(Param.IndexRange.NbSlice)
-    NbSlice=Param.IndexRange.NbSlice;
-end
+% NbSlice=1;%default
+% if isfield(Param.IndexRange,'NbSlice')&&~isempty(Param.IndexRange.NbSlice)
+%     NbSlice=Param.IndexRange.NbSlice;
+% end
 nbview=numel(i1_series);%number of input file series (lines in InputTable)
-nbfield_j=size(i1_series{1},1); %nb of fields for the j index (bursts or volume slices)
+nbfield_j=size(j1_series{1},1); %nb of fields for the j index (bursts or volume slices)
 nbfield_i=size(i1_series{1},2); %nb of fields for the i index
 nbfield=nbfield_j*nbfield_i; %total number of fields
-nbfield_i=floor(nbfield/NbSlice);%total number of  indexes in a slice (adjusted to an integer number of slices)
-nbfield=nbfield_i*NbSlice; %total number of fields after adjustement
 
 %determine the file type on each line from the first input file
@@ -153,7 +152,4 @@
 end
 NomTypeOut='_1-2_1';% output file index will indicate the first and last ref index in the series
-if checkrun==1
-    return % stop here for input checks
-end
 
 %% Set field names and velocity types
@@ -419,5 +415,5 @@
 
 %name of result file
-OutputFile=fullfile_uvmat(RootPath{1},OutputDir,RootFile{1},FileExtOut,NomTypeOut,i1_series{1}(1),i1_series{1}(end),i_slice,[]);
+OutputFile=fullfile_uvmat(RootPath{1},OutputDir,RootFile{1},FileExtOut,NomTypeOut,i1_series{1}(1),i1_series{1}(end),j1_series{1}(1),j1_series{1}(end));
 errormsg=struct2nc(OutputFile,DataOut); %save result file
 if isempty(errormsg)
Index: /trunk/src/set_object.m
===================================================================
--- /trunk/src/set_object.m	(revision 605)
+++ /trunk/src/set_object.m	(revision 606)
@@ -213,6 +213,5 @@
 if ~isempty(hseries)
     hhseries=guidata(hseries);
-    set(hhseries.CheckObject,'Value',0)
-    set(hhseries.CheckObject,'BackgroundColor',[0 1 0])%put unactivated buttons to green
+    set(hhseries.ViewObject,'Value',0)
 end
 
Index: /trunk/src/uigetfile_uvmat.m
===================================================================
--- /trunk/src/uigetfile_uvmat.m	(revision 606)
+++ /trunk/src/uigetfile_uvmat.m	(revision 606)
@@ -0,0 +1,206 @@
+%'uigetfile_uvmat': browser faster than the Matlab fct uigetfile 
+%------------------------------------------------------------------------
+% hfig=uigetfile_uvmat(OutputDir,option)
+%
+% OUTPUT:
+% hfig: handles of the browser fig, the selected file name is obtained as File=get(hfig,'UserData')
+%
+% INPUT:
+% option: ='file browser': usual browser, 'series status': display advancement of a series calculation
+% InputDir: directory to browse at first display
+
+
+function hfig=uigetfile_uvmat(option,InputDir)
+if ~exist(InputDir,'dir')
+    InputDir=pwd;
+end
+hfig=findobj(allchild(0),'name',option);
+if isempty(hfig)
+    ScreenSize=get(0,'ScreenSize');% get the size of the screen, to put the fig on the upper right
+    hfig=figure('name',option,'tag',option,'MenuBar','none','NumberTitle','off','Position',[ScreenSize(3)-600 ScreenSize(4)-640 560 600],'DeleteFcn',@stop_status,'UserData',InputDir);
+    uicontrol('Style','listbox','Units','normalized', 'Position',[0.05 0.09 0.9 0.71], 'Callback', @(src,event)view_file(option,src,event),'tag','list','FontSize',12);
+    uicontrol('Style','edit','Units','normalized', 'Position', [0.05 0.87 0.9 0.1],'tag','titlebox','Max',2,'String',InputDir,'FontSize',12,'FontWeight','bold');
+    uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.7 0.01 0.2 0.07],'String','Close','FontWeight','bold','FontUnits','points','FontSize',12,'Callback',@stop_status);
+    uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.1 0.01 0.2 0.07],'String','Refresh','FontWeight','bold','FontUnits','points','FontSize',12,'Callback',@refresh_GUI);
+    %set(hrefresh,'UserData',StatusData)
+    if strcmp(option,'series status') %put a run advancement display
+        uicontrol('Style','frame','Units','normalized', 'Position',[0.05 0.81 0.01 0.05],'BackgroundColor',[1 0 0],'tag','waitbar');
+        uicontrol('Style','frame','Units','normalized', 'Position', [0.05 0.81 0.9 0.05]);
+    else  %put a title
+        uicontrol('Style','text','Units','normalized', 'Position', [0.05 0.81 0.9 0.03],'String','select an input file:',...
+            'FontSize',14,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','left');
+        uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.4 0.01 0.2 0.07],'String','Home','FontWeight','bold','FontUnits','points','FontSize',12,'Callback',@home_dir);
+    end
+    drawnow
+end
+refresh_GUI(hfig)
+    
+%------------------------------------------------------------------------   
+% --- launched by selecting a file on the list
+function view_file(option,hObject,event)
+%------------------------------------------------------------------------
+list=get(hObject,'String');
+index=get(hObject,'Value');
+hfig=get(hObject,'parent');
+DirName=get(get(hObject,'parent'),'UserData');
+SelectName=regexprep(list{index},'^/','');% remove the / used to mark dir
+if strcmp(SelectName,'..')
+    FullSelectName=fileparts(DirName);
+else
+%ind_dot=regexp(SelectName,'\.\.\.');
+% if ~isempty(ind_dot)
+%     SelectName=SelectName(1:ind_dot-1);
+% end
+FullSelectName=fullfile(DirName,SelectName);
+end
+if exist(FullSelectName,'dir')% a directory has been selected
+%     ListFiles=dir(FullSelectName);
+%     ListDisplay=cell(numel(ListFiles),1);
+%     for ilist=2:numel(ListDisplay)% suppress the first line '.'
+%         ListDisplay{ilist-1}=ListFiles(ilist).name;
+%     end
+%     set(hObject,'Value',1)
+%     set(hObject,'String',ListDisplay)
+%     if strcmp(selectname,'..')
+%         FullSelectName=fileparts(fileparts(FullSelectName));
+%     end
+    ListFiles=list_files(FullSelectName);
+    set(hObject,'Value',1)
+    set(hObject,'String',ListFiles)
+    set(hfig,'UserData',FullSelectName)% record the new dir name
+    htitlebox=findobj(hfig,'tag','titlebox');  % display the new dir name  
+    set(htitlebox,'String',FullSelectName)
+elseif exist(FullSelectName,'file')%visualise the field if it exists
+    FileType=get_file_type(FullSelectName);
+    if strcmp(FileType,'txt')
+        edit(FullSelectName)
+    elseif strcmp(FileType,'xml')
+        editxml(FullSelectName)
+            elseif strcmp(FileType,'figure')
+        open(FullSelectName)
+    else
+        %uvmat(FullSelectName);
+        switch option
+            case 'file browser'
+        hfig=get(hObject,'parent');
+        set(hfig,'UserData',FullSelectName);
+        uiresume(hfig)
+            case 'series status'
+           uvmat(FullSelectName);
+        end
+    end
+    set(gcbo,'Value',1)
+end
+
+%------------------------------------------------------------------------   
+% --- launched by selecting home
+function home_dir(hObject,event)
+DirName=pwd;
+
+ListFiles=list_files(DirName);% list the directory content
+hfig=get(hObject,'parent');
+    set(hfig,'UserData',DirName)% record the new dir name
+    htitlebox=findobj(hfig,'tag','titlebox');  % display the new dir name  
+    set(htitlebox,'String',DirName)
+    hlist=findobj(hfig,'tag','list');% find the list object
+set(hlist,'String',ListFiles)
+%------------------------------------------------------------------------
+
+%------------------------------------------------------------------------   
+% --- launched by refreshing the display figure
+function refresh_GUI(hfig,event)
+%------------------------------------------------------------------------
+DirName=get(hfig,'UserData');
+ListFiles=list_files(DirName);% list the directory content
+hlist=findobj(hfig,'tag','list');% find the list object
+set(hlist,'String',ListFiles)
+return
+
+%TODO adapt to series status
+hseries=findobj(allchild(0),'tag','series');
+hstatus=findobj(hseries,'tag','status');
+StatusData=get(hstatus,'UserData');
+TimeStart=0;
+if isfield(StatusData,'TimeStart')
+    TimeStart=StatusData.TimeStart;
+end
+% testrecent=0;
+% datnum=zeros(numel(ListDisplay),1);
+% for ilist=1:numel(ListDisplay)
+%     ListDisplay{ilist}=ListFiles(ilist).name;
+%     if ListFiles(ilist).isdir
+%         ListDisplay{ilist}=['/' ListDisplay{ilist}];    
+%     elseif isfield(ListFiles(ilist),'datenum')
+%         datnum(ilist)=ListFiles(ilist).datenum;%only available in recent matlab versions
+%         testrecent=1;
+%         if datnum(ilist)<TimeStart
+%             ListDisplay{ilist}=[ListDisplay{ilist} '  --OLD--'];
+%         end
+%     end
+% end
+
+
+%% Look at date of creation
+ListDisplay=ListDisplay(datnum~=0);
+datnum=datnum(datnum~=0);%keep the non zero values corresponding to existing files
+
+NbOutputFile=[];
+if isempty(datnum)
+    if testrecent
+        message='no result created yet';
+    else
+        message='';
+    end
+else
+    [first,indfirst]=min(datnum);
+    [last,indlast]=max(datnum);
+    NbOutputFile_str='?';
+    if isfield(StatusData,'NbOutputFile')
+        NbOutputFile=StatusData.NbOutputFile;
+        NbOutputFile_str=num2str(NbOutputFile);
+    end
+    message={[num2str(numel(datnum)) ' file(s) done over ' NbOutputFile_str] ;['oldest modification:  ' ListDisplay{indfirst} ' : ' datestr(first)];...
+        ['latest modification:  ' ListDisplay{indlast} ' : ' datestr(last)]};
+end
+set(htitlebox,'String', [DirName{1};message])
+
+%% update the waitbar
+hwaitbar=findobj(hfig,'tag','waitbar');
+if ~isempty(NbOutputFile) 
+    BarPosition=get(hwaitbar,'Position');
+    BarPosition(3)=0.9*numel(datnum)/NbOutputFile;
+    set(hwaitbar,'Position',BarPosition)
+end
+
+%-------------------------------------------------------------------------   
+% list the content of a directory
+function ListFiles=list_files(DirName)
+%-------------------------------------------------------------------------
+ListStruct=dir(DirName);
+if numel(ListStruct)<1
+    ListFiles={};
+    return
+end
+if strcmp(ListStruct(1).name,'.')
+    ListStruct(1)=[];%removes the first line ='.'
+end
+ListCells=struct2cell(ListStruct);% transform dir struct to a cell arrray
+ListFiles=ListCells(1,:);%list of file names
+check_dir=cell2mat(ListCells(4,:));% check directories
+ListFiles(check_dir)=regexprep(ListFiles(check_dir),'^.+','/$0');% put '/' in front of dir name display
+[tild,index_sort]=sort(check_dir,2,'descend');% sort 
+ListFiles=ListFiles(index_sort);% list of names sorted by alaphabetical order and dir and file 
+cell_remove=regexp(ListFiles,'^(-|\.|/\.)');% remove strings beginning by '/.',';' or '-' 
+check_remove=cellfun('isempty',cell_remove);
+ListFiles=[{'/..'} ListFiles(check_remove)];
+
+%-------------------------------------------------------------------------   
+% launched by deleting the status figure
+function stop_status(hObject, eventdata)
+%-------------------------------------------------------------------------
+hciv=findobj(allchild(0),'tag','series');
+hhciv=guidata(hciv);
+set(hhciv.status,'value',0) %reset the status uicontrol in the GUI civ
+set(hhciv.status,'BackgroundColor',[0 1 0])
+delete(gcbf)
+
Index: /trunk/src/uvmat.m
===================================================================
--- /trunk/src/uvmat.m	(revision 605)
+++ /trunk/src/uvmat.m	(revision 606)
@@ -341,10 +341,22 @@
     oldfile=get(handles.RootPath,'UserData');
 end
-[FileName, PathName] = uigetfile({'*.*','All Files(*.*)'},'Pick a file',oldfile);
-if ~ischar(FileName),return,end %abandon if the browser is cancelled
-fileinput=[PathName FileName];%complete file name 
+hfig=uigetfile_uvmat('file browser',fileparts(oldfile));
+uiwait(hfig);
+if ishandle(hfig) % stop if browser closed without selection
+    fileinput=get(hfig,'UserData');% retrieve the input file selection
+    delete(hfig)
+    % display the selected field and related information
+    display_file_name(handles,fileinput)
+end
+
+% 
+% 
+% 
+% [FileName, PathName] = uigetfile({'*.*','All Files(*.*)'},'Pick a file',oldfile);
+% if ~ischar(FileName),return,end %abandon if the browser is cancelled
+% fileinput=[PathName FileName];%complete file name 
 
 %% display the selected field and related information
-display_file_name( handles,fileinput)
+% display_file_name( handles,fileinput)
 
 % -----------------------------------------------------------------------
@@ -2673,4 +2685,7 @@
     for imap=1:numel(IndexObj)
         iobj=IndexObj(imap);
+        if numel(UvData.Object)<iobj
+            break
+        end
         [ObjectData,errormsg]=proj_field(UvData.Field,UvData.Object{iobj});% project field on the object
         if ~isempty(errormsg)
