Index: trunk/src/civ.m
===================================================================
--- trunk/src/civ.m	(revision 82)
+++ trunk/src/civ.m	(revision 84)
@@ -51,5 +51,5 @@
 % handles    structure with handles and user data (see GUIDATA)
 % varargin   command line arguments to civ (see VARARGIN)
-global test_batch patch_newBin CivBin%=1 if patch processing available
+global patch_newBin %=1 if new patch processing available
 %filebase: root name 
 %nom_type: nomencalture used ('png_old','_i_j'...)
@@ -127,12 +127,6 @@
     test_batch=strcmp(sparam.BatchParam.BatchMode,'sge'); %sge is currently the only implemented batch mod
 end
-% if isfield(sparam,'PatchNewBin')
-%     patch_newBin=sparam.PatchNewBin;
-% end
-% if isfield(sparam,'SGE')
-%     sge=str2double(sparam.SGE);
-% end   
-% test_batch=sge;%default
 if test_batch==0
+    set(handles.BATCH,'Enable','off')% put the BATCH button in grey (unactivated)
     set(handles.BATCH,'BackgroundColor',[0.831 0.816 0.784])% put the BATCH button in grey (unactivated)
 end
@@ -297,7 +291,4 @@
 [RootPath,RootFile,str1,str2,str_a,str_b,ext,nom_type,subdir]=name2display(fileinput);
 filebase=fullfile(RootPath,RootFile);
-% if isequal(nom_type,'*')% all fields in a single file ( movie files)
-%     num_i1=1;num_i2=1;num_j1=1;num_j2=1;
-% else
 num_i1=stra2num(str1);
 if isempty(num_i1),num_i1=1;end
@@ -318,7 +309,4 @@
     browse.nom_type_ima=nom_type;
     browse.field_count=num_i1;
-%     A=imread(fileinput);
-%     npxy=size(A);
-%     set(handles.ImaExt,'UserData',npxy)
 end
 set(handles.ImaDoc,'String',ext);
@@ -437,5 +425,4 @@
 function RootName_Callback(hObject, eventdata, handles)
 %------------------------------------------------------------------------
-global test_batch
 set(handles.compare,'Visible','on')
 ext_ima=get(handles.ImaExt,'String'); 
@@ -510,22 +497,15 @@
 
 %%%%%%%%   read image documentation file  %%%%%%%%%%%%%%%%%%%%%%%%%%%
-    mode=''; %default
-    set(handles.ImaDoc,'BackgroundColor',[1 1 0])
-    drawnow
-    %read the image documentation file if found
+mode=''; %default
+set(handles.ImaDoc,'BackgroundColor',[1 1 0])
+drawnow
 if isequal(ext,'.civxml') || isequal(ext,'.xml')|| isequal(ext,'.civ')
     set(handles.ref_i,'Visible','On')%use a reference index
     set(handles.ref_j,'Visible','On')
-%     set(handles.dt,'Visible','Off')
- %   set(handles.root_txt,'String','')
 elseif isequal(ext,'.avi') || isequal(ext,'.AVI')
     set(handles.ref_j,'Visible','Off')
- %   set(handles.dt,'Visible','Off')
- %   set(handles.root_txt,'String','ref. ind.')
 else
     set(handles.ref_i,'Visible','Off')
     set(handles.ref_j,'Visible','Off')
- %   set(handles.dt,'Visible','On')
- %   set(handles.root_txt,'String','dt(ms)=')
 end
 testima_xml=0;
@@ -538,9 +518,4 @@
 elseif isequal(ext,'.xml')
     [XmlData,warntext]=imadoc2struct([filebase '.xml']);
-    if isfield(XmlData,'Time')
-        time=XmlData.Time;
-        nbfield=size(time,1);
-        nburst=size(time,2);
-    end
     ext_ima_read=[];
     nom_type_read=[];
@@ -550,4 +525,17 @@
         if ~exist(fullname,'file')
             msgbox_uvmat('WARNING',['FirstImage ' fullname ' defined in the xml file does not exist'])
+        end
+    end
+    if isfield(XmlData,'Time')
+        time=XmlData.Time
+        nbfield=size(time,1);
+        nburst=size(time,2);
+        %transform .Time to a column vector if it is a line vector the nomenclature uses a single index
+        if isequal(nbfield,1) && ~isequal(nburst,1)% .Time is a line vector
+            if numel(nom_type_read)>=2 && (strcmp(nom_type_read,'_i')||strcmp(nom_type_read(1:2),'%0')||strcmp(nom_type_read(1:2),'_%'))
+                time=time';
+                nbfield=nburst;
+                nburst=1;
+            end
         end
     end
@@ -748,6 +736,5 @@
 set(handles.RUN, 'Enable','On')
 set(handles.RUN,'BackgroundColor',[1 0 0])
-if isequal(test_batch,1)%if batch installation is available
-    set(handles.BATCH, 'Enable','On')
+if isequal(get(handles.BATCH, 'Enable'),'On')
     set(handles.BATCH,'BackgroundColor',[1 0 0])
 end
@@ -3374,5 +3361,5 @@
                     filename=name_generator(filebase_ima1,num1_civ2(ifile),num_a_civ2(j),'.png',nom_type_imanew1);
                     if ~exist(filename,'file')
-                        A=read_image(cell2mat(filecell.ima1.civ2(ifile,j)),nom_type_ima2,num1_civ2(ifile));
+                        A=read_image(cell2mat(filecell.ima1.civ2(ifile,j)),type_ima2,num1_civ2(ifile));
                         imwrite(A,filename,'BitDepth',16); 
                     end
@@ -3380,5 +3367,5 @@
                     filename=name_generator(filebase_ima2, num2_civ2(ifile),num_b_civ2(j),'.png',nom_type_imanew2);
                     if ~exist(filename,'file')
-                        A=read_image(cell2mat(filecell.ima2.civ2(ifile,j)),nom_type_ima2,num2.civ1(ifile));
+                        A=read_image(cell2mat(filecell.ima2.civ2(ifile,j)),type_ima2,num2_civ2(ifile));
                         imwrite(A,filename,'BitDepth',16);
                     end
