Index: trunk/src/cluster_command.m
===================================================================
--- trunk/src/cluster_command.m	(revision 1170)
+++ trunk/src/cluster_command.m	(revision 1171)
@@ -33,5 +33,6 @@
           corestring='cpu=1/core=4'; %increases the allowed memory in case of single core job
       else
-          corestring=['/core=' num2str(NbCore)]; 
+         % corestring=['/core=' num2str(NbCore)]; 
+         corestring=['{cluster=''calcul8''}/core=' num2str(NbCore)]; 
       end
                                                                 cmd=['oarsub -n UVmat_' ActionFullName ' '...
Index: trunk/src/series.m
===================================================================
--- trunk/src/series.m	(revision 1170)
+++ trunk/src/series.m	(revision 1171)
@@ -138,13 +138,17 @@
 if ~exist(xmlfile,'file')
     [success,message]=copyfile(fullfile(path_series,'series.xml.default'),xmlfile);
+    if success==0
+        disp(message)
+        return
+    end
 end
 if exist(xmlfile,'file')
-    SeriesData=xml2struct(xmlfile);
+    SeriesData=xml2struct(xmlfile);% read the xml file containing parameters for series computations
     if ~(isfield(SeriesData,'ClusterParam')&& isfield(SeriesData.ClusterParam,'LaunchCmdFcn'))
-        [success,message]=copyfile(xmlfile,fullfile(path_series,'series_old.xml'));% update the file series.xml inot correctly documented
+        [success,message]=copyfile(xmlfile,fullfile(path_series,'series.xml~'));% backup the file series.xml, not correctly documented
         delete(xmlfile);
-        [success,message]=copyfile(fullfile(path_series,'series.xml.default'),xmlfile);
-    end
-    SeriesData=xml2struct(xmlfile);
+        [success,message]=copyfile(fullfile(path_series,'series.xml.default'),xmlfile);% use the defualt series.xml
+    end
+    SeriesData=xml2struct(xmlfile);% read again the xml file containing parameters for series computations
 end
 
@@ -160,18 +164,19 @@
 ActionPathList(:)={path_series_fct}; % set the default path to series fcts to all list members
 RunModeList={'local';'background'}; % default choice of extensions (Matlab fct .m or compiled version .sh)
-if isfield(SeriesData.ClusterParam.ExistenceTest,'Text')
-    oarcommand=SeriesData.ClusterParam.ExistenceTest.Text;
+if isfield(SeriesData.ClusterParam, 'ExistenceTest')
+    oarcommand=SeriesData.ClusterParam.ExistenceTest;
+    [s,w]=system(oarcommand); % look for cluster system presence
+    if isequal(s,0)% cluster detected
+        RunModeList=[RunModeList;{'cluster'}];
+        set(handles.MonitorCluster,'Visible','on'); % make visible button for access to Monika
+        set(handles.num_CPUTime,'Visible','on'); % make visible button for CPU time estimate for one ref index
+        set(handles.num_CPUTime,'String','')% default CPU time undefined
+        set(handles.CPUTime_txt,'Visible','on'); % make visible button for CPU time title
+    end
+    set(handles.RunMode,'String',RunModeList)% display the menu of available run modes, local, background or cluster manager
 else
-    oarcommand=SeriesData.ClusterParam.ExistenceTest;
-end
-[s,w]=system(oarcommand); % look for cluster system presence
-if isequal(s,0)
-    RunModeList=[RunModeList;{'cluster'}];
-    set(handles.MonitorCluster,'Visible','on'); % make visible button for access to Monika
-    set(handles.num_CPUTime,'Visible','on'); % make visible button for CPU time estimate for one ref index
-    set(handles.num_CPUTime,'String','')% default CPU time undefined
-    set(handles.CPUTime_txt,'Visible','on'); % make visible button for CPU time title
-end
-set(handles.RunMode,'String',RunModeList)% display the menu of available run modes, local, background or cluster manager
+    disp('no cluster availability test in series.xml')
+end
+
 
 %% list of builtin transform functions in the menu TransformName
@@ -1438,24 +1443,8 @@
 if strcmp(RunMode,'local')
     current_dir=pwd; % current working dir
-cd(ActionPath)
-h_fun=str2func(ActionName);% create the function handle for the function ActionName
-cd(current_dir)
-    % if ~isequal(ActionPath,path_series)
-    % 
-    %     %eval(['spath=which(''' ActionName ''');']) %spath = current path of the selected function ACTION
-    %     if ~exist(ActionPath,'dir')
-    %         errormsg=['The prescribed function path ' ActionPath ' does not exist'];
-    %         return
-    %     end
-    %     spath=fileparts(which(ActionName));
-    %     if ~strcmp(spath,ActionPath)
-    %         addpath(ActionPath)% add the prescribed path if not the current one
-    %     end
-    % end
-    % eval(['h_fun=@' ActionName ';'])%create a function handle for ACTION
-    % if ~isequal(ActionPath,path_series)
-    %     rmpath(ActionPath)% add the prescribed path if not the current one
-    % end
- end
+    cd(ActionPath)
+    h_fun=str2func(ActionName);% create the function handle for the function ActionName
+    cd(current_dir)
+end
 
 %% Get  parameters from series.xml
@@ -1533,30 +1522,4 @@
 % NbCore is the number of computer processors used
 % NbProcess is the number of independent processes in which the required calculation is split.
-% switch RunMode
-%     case {'local','background'}
-%         NbCore=1; % no need to split the calculation
-%     case 'cluster'
-%         %proposed number of cores to reserve in the cluster
-%         NbCoreAdvised=SeriesData.ClusterParam.NbCoreAdvised;
-%         NbCoreMax=min(NbProcess,SeriesData.ClusterParam.NbCoreMax);
-%         if NbCoreMax~=1
-%             if strcmp(ActionExt,'.m')% case of Matlab function (uncompiled)
-%                 warning_string=', preferably use .sh option to save Matlab licences';
-%             else
-%                 warning_string=')';
-%             end
-%             answer=msgbox_uvmat('INPUT_TXT',['Number of cores (max ' num2str(NbCoreMax) ', ' warning_string],num2str(NbCoreAdvised));
-%             if isempty(answer)
-%                 errormsg='Action launch interrupted by user';
-%                 return
-%             end
-%             NbCore=str2double(answer);
-%             if NbCore > NbCoreMax
-%                 NbCore=NbCoreMax;
-%             end
-%         else
-%             NbCore=1;
-%         end
-% end
 if ~isfield(Param.IndexRange,'NbSlice')
     Param.IndexRange.NbSlice=[];
@@ -1586,42 +1549,28 @@
         for iexp=1:numel(ListExp)
             if ~isempty(regexp(ListExp{iexp},'^\+/'))% if it is a folder
-               %if strcmp(get(BrowseData.DataSeries,'enable'),'off') %case of a multiple input line for series
-%                     NbExp=NbExp+1;
-%                     ExpIndex{NbExp}=iexp;
-%                     for idevice=1:numel(ListDevices)
-%                         lpath= fullfile(SourceDir,regexprep(ListExp{iexp},'^\+/',''),...
-%                             regexprep(ListDevices{idevice},'^\+/',''));
-%                         lpathout=fullfile(OutputPath,regexprep(ListExp{iexp},'^\+/',''),...
-%                             regexprep(ListDevices{idevice},'^\+/',''));
-%                         ldir=regexprep(ListDataSeries{idevice},'^\+/','');
-%                         ListPath{idevice,NbExp}=lpath;
-%                         ListPathOut{idevice,NbExp}=lpathout;
-%                         ListSubdir{idevice,NbExp}=ldir;
-%                     end
-                %else
-                    for idevice=1:numel(ListDevices)
-                        if ~isempty(regexp(ListDevices{idevice},'^\+/'))% if it is a folder
-                            for isubdir=1:numel(ListDataSeries)
-                                if ~isempty(regexp(ListDataSeries{isubdir},'^\+/'))% if it is a folder
-                                    lpath= fullfile(SourceDir,regexprep(ListExp{iexp},'^\+/',''),...
-                                        regexprep(ListDevices{idevice},'^\+/',''));
-                                    lpathout= fullfile(OutputPath,regexprep(ListExp{iexp},'^\+/',''),...
-                                        regexprep(ListDevices{idevice},'^\+/',''));
-                                    ldir= regexprep(ListDataSeries{isubdir},'^\+/','');
-                                    if exist(fullfile(lpath,ldir),'dir')
-                                        NbExp=NbExp+1;
-                                        ExpIndex(NbExp)=ExpIndices(iexp);
-                                        DeviceIndex(NbExp)=DeviceIndices(idevice);
-                                        ListPath{NbExp}=lpath;
-                                        ListPathOut{NbExp}=lpathout;
-                                        ListDeviceOut{NbExp}=regexprep(ListDevices{idevice},'^\+/','');
-                                        ListExpOut{NbExp}=regexprep(ListExp{iexp},'^\+/','');
-                                        ListSubdir{NbExp}=ldir;
-                                    end
+                for idevice=1:numel(ListDevices)
+                    if ~isempty(regexp(ListDevices{idevice},'^\+/'))% if it is a folder
+                        for isubdir=1:numel(ListDataSeries)
+                            if ~isempty(regexp(ListDataSeries{isubdir},'^\+/'))% if it is a folder
+                                lpath= fullfile(SourceDir,regexprep(ListExp{iexp},'^\+/',''),...
+                                    regexprep(ListDevices{idevice},'^\+/',''));
+                                lpathout= fullfile(OutputPath,regexprep(ListExp{iexp},'^\+/',''),...
+                                    regexprep(ListDevices{idevice},'^\+/',''));
+                                ldir= regexprep(ListDataSeries{isubdir},'^\+/','');
+                                if exist(fullfile(lpath,ldir),'dir')
+                                    NbExp=NbExp+1;
+                                    ExpIndex(NbExp)=ExpIndices(iexp);
+                                    DeviceIndex(NbExp)=DeviceIndices(idevice);
+                                    ListPath{NbExp}=lpath;
+                                    ListPathOut{NbExp}=lpathout;
+                                    ListDeviceOut{NbExp}=regexprep(ListDevices{idevice},'^\+/','');
+                                    ListExpOut{NbExp}=regexprep(ListExp{iexp},'^\+/','');
+                                    ListSubdir{NbExp}=ldir;
                                 end
                             end
                         end
                     end
-%                 end
+                end
+                %                 end
             end
         end
@@ -1829,6 +1778,16 @@
                 Param.Action.CPUTime=CPUTime;
             end
-            JobNumberMax=SeriesData.ClusterParam.JobNumberMax;
-            JobCPUTimeAdvised=SeriesData.ClusterParam.JobCPUTimeAdvised;
+            if isfield(SeriesData.ClusterParam,'JobNumberMax')
+                JobNumberMax=SeriesData.ClusterParam.JobNumberMax;
+            else
+                disp('ClusterParam.JobNumberMax not documented in series.xml, set to 500 by default')
+                JobNumberMax=500;
+            end
+            if isfield(SeriesData.ClusterParam,'JobCPUTimeAdvised')
+                JobCPUTimeAdvised=SeriesData.ClusterParam.JobCPUTimeAdvised;
+            else
+                disp('ClusterParam.JobCPUTimeAdvised not documented in series.xml, set to 120 minutes by default')
+                JobCPUTimeAdvised=120;
+            end
             if isempty(Param.IndexRange.NbSlice)% if NbSlice is not defined
                 BlockLength= ceil(JobCPUTimeAdvised/(CPUTime*nbfield_j)); % iterations are grouped in sets with length BlockLength  such that the typical CPU time of a job is JobCPUTimeAdvised.
@@ -1838,8 +1797,18 @@
                 NbProcess=Param.IndexRange.NbSlice; % the parameter NbSlice sets the nbre of run processes
             end
-
+            
             %         %proposed number of cores to reserve in the cluster
-            NbCoreAdvised=SeriesData.ClusterParam.NbCoreAdvised;
-            NbCoreMax=min(NbProcess,SeriesData.ClusterParam.NbCoreMax);% reduces the number of cores if it exceeds the number of processes
+             if isfield(SeriesData.ClusterParam,'NbCoreAdvised')
+                NbCoreAdvised=SeriesData.ClusterParam.NbCoreAdvised;
+            else
+                disp('ClusterParam.NbCoreAdvised not documented in series.xml, set to 16 by default')
+                NbCoreAdvised=16;
+             end
+                if isfield(SeriesData.ClusterParam,'NbCoreMax')
+                NbCoreMax=min(NbProcess,SeriesData.ClusterParam.NbCoreMax);% reduces the number of cores if it exceeds the number of processes
+            else
+                disp('ClusterParam.NbCoreMax not documented in series.xml, set to 36 by default')
+                NbCoreMax=min(NbProcess,36);
+                end
             if NbCoreMax~=1
                 if strcmp(ActionExt,'.m')% case of Matlab function (uncompiled)
@@ -1848,6 +1817,6 @@
                     warning_string=')';
                 end
-                answer=msgbox_uvmat('INPUT_TXT',['Number of cores (max ' num2str(NbCoreMax) ', ' warning_string],num2str(NbCoreAdvised));
-                if isempty(answer)
+                answer=msgbox_uvmat('INPUT_TXT',['Number of cores (limited to ' num2str(NbCoreMax) warning_string],num2str(NbCoreAdvised));
+                if isempty(answer)||strcmp(answer,'Cancel')
                     errormsg='Action launch interrupted by user';
                     return
@@ -2106,5 +2075,10 @@
             end
             CPUTimeProcess=CPUTime*BlockLength*nbfield_j; % estimated CPU time for one individual process (in minutes)
+            if isfield(SeriesData.ClusterParam,'LaunchCmdFcn')&& exist(SeriesData.ClusterParam.LaunchCmdFcn,'file')
             LaunchCmdFcn=SeriesData.ClusterParam.LaunchCmdFcn;% command obtained from the function 
+            else
+                disp('no ClusterParam.LaunchCmdFcn defined in series.xml')
+                return
+            end
             oar_command=feval(LaunchCmdFcn,ListProcess,ActionFullName,DirLog,NbProcess, NbCore,CPUTimeProcess)
             [status,result]=system(oar_command)% execute system command and show the result (ID number of the launched job) on the Matlab command window
Index: trunk/src/series.xml.default
===================================================================
--- trunk/src/series.xml.default	(revision 1170)
+++ trunk/src/series.xml.default	(revision 1171)
@@ -3,5 +3,5 @@
    <DiskQuotaCmd>quota -s -g -A</DiskQuotaCmd> 
    <ClusterParam>
-      <ExistenceTest>oarstat</ExistenceTest>
+      <ExistenceTest>oarstat</ExistenceTest>                   <!-- command used to detect the availability of the cluster -->
       <NbCoreAdvised>16</NbCoreAdvised>                        <!-- proposed default number of parallel cores attributed for the computations -->
       <NbCoreMax>36</NbCoreMax>                                <!-- maximum number of cores allowed for the computations -->
Index: trunk/src/series/civ_input.m
===================================================================
--- trunk/src/series/civ_input.m	(revision 1170)
+++ trunk/src/series/civ_input.m	(revision 1171)
@@ -1564,8 +1564,8 @@
     r=regexp(str_civ,'^\D(?<ind>[i|j])=( -| )(?<num1>\d+)\|(?<num2>\d+)','names');
     if ~isempty(r)
-        if strmp(r.ind,'i')
+        if strcmp(r.ind,'i')
             i1=i1-str2num(r.num1);
             i2=i2 +str2num(r.num2);
-        elseif strmp(r.ind,'j')
+        elseif strcmp(r.ind,'j')
             j1=j1-str2num(r.num1);
             j2=j2 +str2num(r.num2);
