Index: /issm/trunk/etc/cluster.rc
===================================================================
--- /issm/trunk/etc/cluster.rc	(revision 2241)
+++ /issm/trunk/etc/cluster.rc	(revision 2242)
@@ -23,6 +23,6 @@
 
 cluster_name=cosmos
-cluster_codepath=/home/larour/tier2_ice/cluster_delivery
-cluster_executionpath=/scratch/larour/Testing/AGU_2008
+cluster_codepath=/work00/edw/larour/issm-2.0/bin
+cluster_executionpath=/work00/edw/larour/Execution
 
 cluster_name=mustang
Index: /issm/trunk/src/c/parallel/steadystate_core.cpp
===================================================================
--- /issm/trunk/src/c/parallel/steadystate_core.cpp	(revision 2241)
+++ /issm/trunk/src/c/parallel/steadystate_core.cpp	(revision 2242)
@@ -78,5 +78,5 @@
 	for(;;){
 	
-		if(debug)_printf_("%s%i\n","computing temperature and velocity for step: ",step);
+		if(debug)_printf_("%s%i\n","   computing temperature and velocity for step: ",step);
 
 		//first compute temperature at steady state.
Index: /issm/trunk/src/m/classes/public/BuildQueueingScriptcosmos.m
===================================================================
--- /issm/trunk/src/m/classes/public/BuildQueueingScriptcosmos.m	(revision 2241)
+++ /issm/trunk/src/m/classes/public/BuildQueueingScriptcosmos.m	(revision 2242)
@@ -1,17 +1,4 @@
 function BuildQueueingScriptcosmos(md,executionpath,codepath)
-%BUILDQUEUEINGSCRIPTCOSMOS - build queueing script for batch system when running parallel
-%
-%   solutiontype is 'diagnostic','prognostic','transient','thermal','parameters' or 'control'
-%   and varargin is an optional package name ('cielo', 'ice' or 'macayeal')
-%
-%   Usage:
-%       md=solve(md,solutiontype,varargin)
-%
-%   Examples:
-%      md=solve(md,'diagnostic','macayeal');
-%
-
-function BuildQueueingScriptcosmos(md,solutiontype,executionpath,codepath)
-%BUILDQUEUEINGSCRIPTCOSMOS - ...
+%BUILDQUEUEINGSCRIPTGEMINI - ...
 %
 %   Usage:
@@ -22,28 +9,63 @@
 fid=fopen(scriptname,'w');
 if fid==-1,
-	error(['BuildQueueingScriptcosmoserror message: could not open ' scriptname ' file for ascii writing']);
+	error(['BuildQueueingScriptcosmos error message: could not open ' scriptname ' file for ascii writing']);
 end
 
-fprintf(fid,'#!/bin/sh\n');
-fprintf(fid,'#BSUB -n %i -W %i\n',md.np,md.time);
-if md.exclusive,
-	fprintf(fid,'#BSUB -x\n');
+%check queue names: 
+available_queues={'debug','shortq','longq','specialq'};
+if  ~ismemberi(md.queue,available_queues),
+	error('BuildQueueingScriptcosmos error message: availables queues are debug, shortq, longq and specialq');
 end
-fprintf(fid,'#BSUB -a mpich_gm\n');
-fprintf(fid,'#BSUB -J %s\n',md.name);
-fprintf(fid,'#BSUB -o %s.outlog -e %s.errlog\n',md.name,md.name);
-fprintf(fid,'cd %s\n',executionpath);
-fprintf(fid,'rm -rf %s.outlog %s.errlog %s.lock\n',md.name,md.name,md.name);
-if md.alloc_cleanup,
-	fprintf(fid,'mpirun.lsf /home/larour/bin/alloc_cleanup.exe\n');
+
+%test parameters for each queue: 
+if strcmpi(md.queue,'debug'),
+	if md.np>32,
+		error('BuildQueueingScriptcosmos error message: debug queue only allows 32 cpus');
+	end
+	if md.time>60,
+		error('BuildQueueingScriptcosmos error message: debug queue only allows 60 minutes');
+	end
 end
-if strcmpi(solutiontype,'diagnostic'),
-	fprintf(fid,'mpirun.lsf %s/diagnostic.exe %s %s.bin %s.outbin %s.lock',codepath,executionpath,md.name,md.name,md.name);
-elseif strcmpi(solutiontype,'control') ,
-	fprintf(fid,'mpirun.lsf %s/control.exe %s %s.bin %s.outbin %s.lock',codepath,executionpath,md.name,md.name,md.name);
-elseif strcmpi(solutiontype,'thermal') ,
-	fprintf(fid,'mpirun.lsf %s/thermal.exe %s %s.bin %s.outbin %s.lock',codepath,executionpath,md.name,md.name,md.name);
-else
-	error('BuildQueueingScriptcosmos error message: unsupported solution type!');
+
+if strcmpi(md.queue,'shortq'),
+	if md.np>128,
+		error('BuildQueueingScriptcosmos error message: shortq queue only allows 128 cpus');
+	end
+	if md.time>180,
+		error('BuildQueueingScriptcosmos error message: shortq queue only allows 180 minutes');
+	end
 end
+
+if strcmpi(md.queue,'longq'),
+	if md.np>128,
+		error('BuildQueueingScriptcosmos error message: longq queue only allows 128 cpus');
+	end
+	if md.time>720,
+		error('BuildQueueingScriptcosmos error message: longq queue only allows 720 minutes');
+	end
+end
+
+if strcmpi(md.queue,'specialq'),
+	if md.np>10,
+		error('BuildQueueingScriptcosmos error message: longq queue only allows 10 cpus');
+	end
+end
+
+
+
+fprintf(fid,'#!/bin/csh\n');
+fprintf(fid,'#PBS -l select=%i:ncpus=1\n',md.np);
+fprintf(fid,'#PBS -l walltime=%i\n',md.time*60); %walltime is in seconds.
+if ~isempty(md.queue),
+	fprintf(fid,'#PBS -q %s\n',md.queue);
+end
+fprintf(fid,'#PBS -o %s.outlog \n',md.name);
+fprintf(fid,'#PBS -e %s.errlog \n',md.name);
+
+fprintf(fid,'setenv PBS_O_WORKDIR %s\n',executionpath);
+fprintf(fid,'cd $PBS_O_WORKDIR\n');
+fprintf(fid,'setenv OMP_NUM_THREADS 1\n');
+fprintf(fid,'limit stacksize unlimited\n');
+fprintf(fid,'limit coredumpsize 0\n');
+fprintf(fid,'/opt/mpich/gm/intel10.1/bin/mpirun -np %i -machinefile $PBS_NODEFILE %s/%s.exe %s %s.bin %s.outbin %s.lock',md.np,codepath,AnalysisTypeFromEnum(md.analysis_type),executionpath,md.name,md.name,md.name);
 fclose(fid);
Index: /issm/trunk/src/m/classes/public/BuildQueueingScriptgemini.m
===================================================================
--- /issm/trunk/src/m/classes/public/BuildQueueingScriptgemini.m	(revision 2241)
+++ /issm/trunk/src/m/classes/public/BuildQueueingScriptgemini.m	(revision 2242)
@@ -24,5 +24,5 @@
 fprintf(fid,'cd $PBS_O_WORKDIR\n');
 fprintf(fid,'export OMP_NUM_THREADS=1\n');
-fprintf(fid,'mpirun -np %i %s/%s.exe %s %s.bin %s.outbin %s.lock',md.np,codepath,AnalysisTypeFromEnum(md.analysis_type),executionpath,md.name,md.name,md.name);
+fprintf(fid,'dplace -s1 -c0-%i mpirun -np %i %s/%s.exe %s %s.bin %s.outbin %s.lock',md.np-1,md.np,codepath,AnalysisTypeFromEnum(md.analysis_type),executionpath,md.name,md.name,md.name);
 
 fclose(fid);
Index: /issm/trunk/src/m/classes/public/LaunchQueueJobcosmos.m
===================================================================
--- /issm/trunk/src/m/classes/public/LaunchQueueJobcosmos.m	(revision 2241)
+++ /issm/trunk/src/m/classes/public/LaunchQueueJobcosmos.m	(revision 2242)
@@ -1,4 +1,4 @@
 function md=LaunchQueueJobcosmos(md,executionpath,options)
-%LAUNCHQUEUEJOBCOSMOS - ...
+%LAUNCHQUEUEJOBGEMINI - ...
 %
 %   Usage:
@@ -14,20 +14,17 @@
 end
 
-%Some special handling here! We could not get lsf to work through ssh, there is always something going badly 
-%in terms of environment variables not being correctly setup. This is due to the fact the ssh does not use a loging 
-%shell! What we therefore did, is figure out every variable setup in a login shell ( you can find it out by typing 
-%export in a login bash shell). Instead of trying to figure out which path variable is not being correctly setup, 
-%we just dump the export command result into a file, which we source before launching our job. This ensures we replicate 
-%exactly the state of a login shell, through ssh.
-cosmosvariableslocation=which('cosmosvariables.sh');
-if isempty(cosmosvariableslocation),
-	error('LaunchQueueJobcosmos error message: could not find environment variables for cosmos cluster!');
+%jpload both files to cluster
+if ~strcmpi(options.batch,'yes'),
+	disp('uploading input file,  queueing script and variables script');
+	if md.qmu_analysis, 
+		eval(['!scp ' md.name '.bin' ' ' md.name '.queue '  md.name '.qmu.in ' md.cluster ':' executionpath]);
+	else
+		eval(['!scp ' md.name '.bin' ' ' md.name '.queue '  md.cluster ':' executionpath]);
+	end
+else
+	disp('batch mode requested: not launching job interactively');
 end
 
-%now upload both files to cluster
-disp('uploading input file,  queueing script and variables script');
-eval(['!scp ' md.name '.bin' ' ' md.name '.queue ' cosmosvariableslocation ' ' md.cluster ':' executionpath]);
-
-disp('launching solution sequence on remote cluster');
-%now call the queuing script to launch the job.
-system(['ssh  ' md.cluster ' ''cd ' executionpath ' && source ./cosmosvariables.sh && bsub <  ' md.name '.queue  && rm cosmosvariables.sh ''']);
+%new cosmos cannot launch across cluster using ssh
+disp(['launch solution sequence on remote cluster by logging into it and typing qsub < ' md.name '.queue']);
+md.waitonlock=0;
Index: /issm/trunk/src/m/classes/public/plot/parse_options.m
===================================================================
--- /issm/trunk/src/m/classes/public/plot/parse_options.m	(revision 2241)
+++ /issm/trunk/src/m/classes/public/plot/parse_options.m	(revision 2242)
@@ -670,4 +670,11 @@
 end
 
+%histnorm_data
+histnorm_data=findarg(optionstring,'histnorm_data');
+if ~isempty(histnorm_data),
+	options_struct.histnorm_data=histnorm_data.value;
+else
+	options_struct.histnorm_data=NaN;
+end
 
 %designvariable
Index: /issm/trunk/src/m/classes/public/plot/plot_manager.m
===================================================================
--- /issm/trunk/src/m/classes/public/plot/plot_manager.m	(revision 2241)
+++ /issm/trunk/src/m/classes/public/plot/plot_manager.m	(revision 2242)
@@ -30,9 +30,6 @@
 			plot_segmentnumbering(md,options_structure,width,i);
 			return;
-		case 'normplot',
-			plot_qmunormplot(md.dakotaresults.dresp_dat,width,i);
-			return;
 		case 'histnorm',
-			plot_qmuhistnorm(md.dakotaresults.dresp_dat);
+			plot_qmuhistnorm(md,options_structure,width,i);
 			return;
 		case 'elements_type',
Index: /issm/trunk/src/m/classes/public/plot/plot_qmuhistnorm.m
===================================================================
--- /issm/trunk/src/m/classes/public/plot/plot_qmuhistnorm.m	(revision 2241)
+++ /issm/trunk/src/m/classes/public/plot/plot_qmuhistnorm.m	(revision 2242)
@@ -1,39 +1,94 @@
 %
-%  plot a relative histogram along with the normal distribution.
-%
-%  []=plot_hist_norm(rfunc1   ,rfunc2  ,hmin,hmax,hnint)
-%  []=plot_hist_norm(data,desc,mu,sigma,hmin,hmax,hnint)
-%
-function []=plot_qmuhistnorm(varargin)
-
-if ~nargin
-    help plot_hist_norm
-    return
-end
+%  plot a relative histogram and cdf optionally along with
+%  a normal distribution.
+%
+%  []=plot_qmuhistnorm(dresp1   ,dresp2  ,hmin,hmax,hnint)
+%  []=plot_qmuhistnorm(samp,desc,mu,sigma,hmin,hmax,hnint)
+%
+%  where the required input is:
+%    dresp1        (structure array, responses)
+%      or
+%    samp          (double array, lists of samples)
+%    desc          (cell array, list of descriptions)
+%
+%  and the optional input is:
+%    dresp2        (structure array, responses)
+%      or
+%    mu            (double vector, means)
+%    sigma         (double vector, standard deviations)
+%
+%    hmin          (numeric, minimum for histogram)
+%    hmax          (numeric, maximum for histogram)
+%    hnint         (numeric, number of intervals for histogram)
+%
+%  the required fields of dresp1 are:
+%    descriptor    (char, description)
+%    sample        (double vector, list of samples)
+%
+%  and the required fields of dresp2 are:
+%    mean          (double, mean of sample)
+%    stddev        (double, standard deviation of sample)
+%
+%  for each response in the input array, this function
+%  calculates and plots a relative histogram and CDF of the list
+%  of samples, and annotates it with the description.  in
+%  addition, a mean and standard deviation may be supplied or
+%  calculated so that a normal distribution and CDF may be
+%  plotted.
+%
+%  dresp1 data would typically be contained in the dakota tabular
+%  output file from a sampling analysis, and dresp2 data would
+%  typically be contained in the dakota output file from a local
+%  sensitivity analysis, both read by dakota_out_parse.
+%
+%  "Copyright 2009, by the California Institute of Technology.
+%  ALL RIGHTS RESERVED. United States Government Sponsorship
+%  acknowledged. Any commercial use must be negotiated with
+%  the Office of Technology Transfer at the California Institute
+%  of Technology.  (NTR 47078)
+%
+%  This software may be subject to U.S. export control laws.
+%  By accepting this  software, the user agrees to comply with
+%  all applicable U.S. export laws and regulations. User has the
+%  responsibility to obtain export licenses, or other export
+%  authority as may be required before exporting such information
+%  to foreign countries or providing access to foreign persons."
+%
+
+
+function plot_qmuhistnorm(md,options_structure,width,i);
+
+%recover histnorm data
+if isnans(options_structure.histnorm_data)
+	error('plot_qmuhistnorm error message: option histnorm_data is required');
+else
+	varargin=options_structure.histnorm_data;
+end
+
+nargin=length(varargin);
 
 %%  process input data and assemble into matrices as needed
-
 ivar=1;
 if isstruct(varargin{ivar})
-    rfunc1=varargin{ivar};
+    dresp1=varargin{ivar};
     ivar=ivar+1;
     
-    desc=cell (1,length(rfunc1));
-    ldata=zeros(1,length(rfunc1));
-    for i=1:length(rfunc1)
-        ldata(i)=length(rfunc1(i).sample);
-    end
-    data=zeros(max(ldata),length(rfunc1));
-    data(:,:)=NaN;
-
-    for i=1:length(rfunc1)
-        desc(i)=cellstr(rfunc1(i).descriptor);
-        data(1:ldata(i),i)=rfunc1(i).sample;
-    end
-else
-    data=varargin{ivar};
+    desc=cell (1,length(dresp1));
+    lsamp=zeros(1,length(dresp1));
+    for i=1:length(dresp1)
+        lsamp(i)=length(dresp1(i).sample);
+    end
+    samp=zeros(max(lsamp),length(dresp1));
+    samp(:,:)=NaN;
+
+    for i=1:length(dresp1)
+        desc(i)=cellstr(dresp1(i).descriptor);
+        samp(1:lsamp(i),i)=dresp1(i).sample;
+    end
+else
+    samp=varargin{ivar};
     ivar=ivar+1;
     
-    ldata(1:size(data,2))=size(data,1);
+    lsamp(1:size(samp,2))=size(samp,1);
 
     if ivar <= nargin && iscell(varargin{ivar})
@@ -46,13 +101,13 @@
 
 if     ivar <= nargin && isstruct(varargin{ivar})
-    rfunc2=varargin{ivar};
-    ivar=ivar+1;
-
-    mu   =zeros(1,length(rfunc2));
-    sigma=zeros(1,length(rfunc2));
-
-    for i=1:length(rfunc2)
-        mu   (i)=rfunc2(i).mean;
-        sigma(i)=rfunc2(i).stddev;
+    dresp2=varargin{ivar};
+    ivar=ivar+1;
+
+    mu   =zeros(1,length(dresp2));
+    sigma=zeros(1,length(dresp2));
+
+    for i=1:length(dresp2)
+        mu   (i)=dresp2(i).mean;
+        sigma(i)=dresp2(i).stddev;
     end
 elseif ivar+1 <= nargin
@@ -61,5 +116,5 @@
             mu   =varargin{ivar};
         else
-            mu   =mean(data);
+            mu   =mean(samp);
             display('Using calculated means.')
         end
@@ -70,5 +125,5 @@
             sigma=varargin{ivar};
         else
-            sigma=std(data);
+            sigma=std(samp);
             display('Using calculated standard deviations.')
         end
@@ -82,5 +137,5 @@
     hmin=varargin{ivar};
 else
-    hmin=min(min(data));
+    hmin=min(min(samp));
 end
 ivar=ivar+1;
@@ -88,5 +143,5 @@
     hmax=varargin{ivar};
 else
-    hmax=max(max(data));
+    hmax=max(max(samp));
 end
 ivar=ivar+1;
@@ -107,13 +162,13 @@
 %  Use -inf and inf in edges to include all non-NaN values.
 
-dhistc=histc(data,edges);
-for i=1:size(data,2)
-    dbelow(i)  =length(find(data(:,i)<edges(  1)))/ldata(i);
-    dhistc(:,i)=dhistc(:,i)                       /ldata(i);
-    dabove(i)  =length(find(data(:,i)>edges(end)))/ldata(i);
+dhistc=histc(samp,edges);
+for i=1:size(samp,2)
+    dbelow(i)  =length(find(samp(:,i)<edges(  1)))/lsamp(i);
+    dhistc(:,i)=dhistc(:,i)                       /lsamp(i);
+    dabove(i)  =length(find(samp(:,i)>edges(end)))/lsamp(i);
 end
 
 if exist('mu','var') && exist('sigma','var')
-    ncol=size(data,2);
+    ncol=size(samp,2);
     for i=1:ncol
         dbelow(ncol+i)=normcdf(edges(  1),mu(i),sigma(i));
@@ -135,7 +190,13 @@
 %  add the annotation
 
-title('Relative Frequency Histogram')
-xlabel('Interval Edge Value')
-ylabel('Relative Frequency')
+if isnans(options_structure.title),
+	options_structure.title='Relative Frequency Histogram';
+end
+if isnans(options_structure.xlabel),
+	options_structure.xlabel='Interval Edge Value';
+end
+if isnans(options_structure.ylabel),
+	options_structure.ylabel='Relative Frequency';
+end
 
 if exist('desc','var')
@@ -163,5 +224,4 @@
     end
 end
-
 
 %  draw the line plot
@@ -207,3 +267,7 @@
 %hold off
 
-end
+if isnan(options_structure.colorbar)
+	options_structure.colorbar=0;
+end
+
+applyoptions(md,[],options_structure);
Index: /issm/trunk/src/m/classes/public/plot/plotdoc.m
===================================================================
--- /issm/trunk/src/m/classes/public/plot/plotdoc.m	(revision 2241)
+++ /issm/trunk/src/m/classes/public/plot/plotdoc.m	(revision 2242)
@@ -43,5 +43,5 @@
 disp('                  - ''thermaltransient_results'': this will display all the time steps of a thermal transient run');
 disp('                  - ''normplot'': norm plot');
-disp('                  - ''histnorm'': histogram normal distribution');
+disp('                  - ''histnorm'': histogram normal distribution. needs option histnorm_data');
 
 answer = lower(input(['more?(y/n) \n'],'s'));
@@ -101,5 +101,9 @@
 disp('       ''scaleruler'': add a scale ruler, ''on'' for default value or [x0 y0 length width numberofticks] where (x0,y0) are the coordinates of the lower left corner');
 disp('       ''wrapping'': repeat ''n'' times the colormap (''n'' must be an integer)');
-disp(' ');
+disp('       ''histnorm_data'': data for histnorm plot.');
+disp('                  {dresp1   ,dresp2  ,hmin,hmax,hnint} or {samp,desc,mu,sigma,hmin,hmax,hnint}');
+disp('                  where dresp1 is a structure array of responses (where we need samp and desc), ');
+disp('                  dresp2 is a structure array of responses (where we only need mu and sigma)');
+disp('                  hmin,hmax and hnint are the minimum, maximum and number of intervals of the histogram (optional)');
 disp('       any options (except ''data'') can be followed by ''#i'' where ''i'' is the subplot number, or ''#all'' if applied to all plots');
 disp('  ');
Index: sm/trunk/src/m/solutions/dakota/plot_hist_norm.m
===================================================================
--- /issm/trunk/src/m/solutions/dakota/plot_hist_norm.m	(revision 2241)
+++ 	(revision )
@@ -1,258 +1,0 @@
-%
-%  plot a relative histogram and cdf optionally along with
-%  a normal distribution.
-%
-%  []=plot_hist_norm(dresp1   ,dresp2  ,hmin,hmax,hnint)
-%  []=plot_hist_norm(samp,desc,mu,sigma,hmin,hmax,hnint)
-%
-%  where the required input is:
-%    dresp1        (structure array, responses)
-%      or
-%    samp          (double array, lists of samples)
-%    desc          (cell array, list of descriptions)
-%
-%  and the optional input is:
-%    dresp2        (structure array, responses)
-%      or
-%    mu            (double vector, means)
-%    sigma         (double vector, standard deviations)
-%
-%    hmin          (numeric, minimum for histogram)
-%    hmax          (numeric, maximum for histogram)
-%    hnint         (numeric, number of intervals for histogram)
-%
-%  the required fields of dresp1 are:
-%    descriptor    (char, description)
-%    sample        (double vector, list of samples)
-%
-%  and the required fields of dresp2 are:
-%    mean          (double, mean of sample)
-%    stddev        (double, standard deviation of sample)
-%
-%  for each response in the input array, this function
-%  calculates and plots a relative histogram and CDF of the list
-%  of samples, and annotates it with the description.  in
-%  addition, a mean and standard deviation may be supplied or
-%  calculated so that a normal distribution and CDF may be
-%  plotted.
-%
-%  dresp1 data would typically be contained in the dakota tabular
-%  output file from a sampling analysis, and dresp2 data would
-%  typically be contained in the dakota output file from a local
-%  sensitivity analysis, both read by dakota_out_parse.
-%
-%  "Copyright 2009, by the California Institute of Technology.
-%  ALL RIGHTS RESERVED. United States Government Sponsorship
-%  acknowledged. Any commercial use must be negotiated with
-%  the Office of Technology Transfer at the California Institute
-%  of Technology.  (NTR 47078)
-%
-%  This software may be subject to U.S. export control laws.
-%  By accepting this  software, the user agrees to comply with
-%  all applicable U.S. export laws and regulations. User has the
-%  responsibility to obtain export licenses, or other export
-%  authority as may be required before exporting such information
-%  to foreign countries or providing access to foreign persons."
-%
-function []=plot_hist_norm(varargin)
-
-if ~nargin
-    help plot_hist_norm
-    return
-end
-
-%%  process input data and assemble into matrices as needed
-
-ivar=1;
-if isstruct(varargin{ivar})
-    dresp1=varargin{ivar};
-    ivar=ivar+1;
-    
-    desc=cell (1,length(dresp1));
-    lsamp=zeros(1,length(dresp1));
-    for i=1:length(dresp1)
-        lsamp(i)=length(dresp1(i).sample);
-    end
-    samp=zeros(max(lsamp),length(dresp1));
-    samp(:,:)=NaN;
-
-    for i=1:length(dresp1)
-        desc(i)=cellstr(dresp1(i).descriptor);
-        samp(1:lsamp(i),i)=dresp1(i).sample;
-    end
-else
-    samp=varargin{ivar};
-    ivar=ivar+1;
-    
-    lsamp(1:size(samp,2))=size(samp,1);
-
-    if ivar <= nargin && iscell(varargin{ivar})
-        desc=varargin{ivar};
-        ivar=ivar+1;
-    else
-        desc={};
-    end 
-end
-
-if     ivar <= nargin && isstruct(varargin{ivar})
-    dresp2=varargin{ivar};
-    ivar=ivar+1;
-
-    mu   =zeros(1,length(dresp2));
-    sigma=zeros(1,length(dresp2));
-
-    for i=1:length(dresp2)
-        mu   (i)=dresp2(i).mean;
-        sigma(i)=dresp2(i).stddev;
-    end
-elseif ivar+1 <= nargin
-    if isnumeric(varargin{ivar})
-        if ~isempty(varargin{ivar})
-            mu   =varargin{ivar};
-        else
-            mu   =mean(samp);
-            display('Using calculated means.')
-        end
-    end
-    ivar=ivar+1;
-    if isnumeric(varargin{ivar})
-        if ~isempty(varargin{ivar})
-            sigma=varargin{ivar};
-        else
-            sigma=std(samp);
-            display('Using calculated standard deviations.')
-        end
-    end
-    ivar=ivar+1;
-end
-
-%%  generate the intervals
-
-if ivar <= nargin && ~isempty(varargin{ivar})
-    hmin=varargin{ivar};
-else
-    hmin=min(min(samp));
-end
-ivar=ivar+1;
-if ivar <= nargin && ~isempty(varargin{ivar})
-    hmax=varargin{ivar};
-else
-    hmax=max(max(samp));
-end
-ivar=ivar+1;
-if ivar <= nargin && ~isempty(varargin{ivar})
-    hnint=varargin{ivar};
-else
-    hnint=50;
-end
-ivar=ivar+1;
-edges=hmin:(hmax-hmin)/hnint:hmax;
-
-%%  generate the histogram counts and make them relative
-
-%  note that for the histc function:
-%  n(k) counts the value x(i) if edges(k) <= x(i) < edges(k+1).
-%  The last bin counts any values of x that match edges(end).
-%  Values outside the values in edges are not counted.
-%  Use -inf and inf in edges to include all non-NaN values.
-
-dhistc=histc(samp,edges);
-for i=1:size(samp,2)
-    dbelow(i)  =length(find(samp(:,i)<edges(  1)))/lsamp(i);
-    dhistc(:,i)=dhistc(:,i)                       /lsamp(i);
-    dabove(i)  =length(find(samp(:,i)>edges(end)))/lsamp(i);
-end
-
-if exist('mu','var') && exist('sigma','var')
-    ncol=size(samp,2);
-    for i=1:ncol
-        dbelow(ncol+i)=normcdf(edges(  1),mu(i),sigma(i));
-        dhistc(1:size(dhistc,1)-1,ncol+i)=...
-            normcdf(edges(2:end  ),mu(i),sigma(i))-...
-            normcdf(edges(1:end-1),mu(i),sigma(i));
-        dabove(ncol+i)=norminv(edges(end),mu(i),sigma(i));
-        if exist('desc','var')
-            desc(ncol+i)={[desc{i} ' norm']};
-        end
-    end
-end
-
-%  draw the bar plot
-
-hl1=bar(edges(1:end-1),dhistc(1:end-1,:));
-ax1=gca;
-
-%  add the annotation
-
-title('Relative Frequency Histogram')
-xlabel('Interval Edge Value')
-ylabel('Relative Frequency')
-
-if exist('desc','var')
-    hleg1=legend(ax1,desc,'Location','NorthWest',...
-                 'Interpreter','none');
-else
-    hleg1=legend(ax1);
-end
-
-%%  generate the cumulative distribution functions
-
-% cdf=zeros(size(dhistc));
-% cdf(1,:)=dhistc(1,:);
-% for i=2:size(dhistc,1)
-%     cdf(i,:)=cdf(i-1,:)+dhistc(i,:);
-% end
-cdf=cumsum(dhistc);
-for i=1:size(dhistc,2)
-    cdf(:,i)=dbelow(i)+cdf(:,i);
-end
-if exist('desc','var')
-    ncol=length(desc);
-    for i=1:ncol
-        cdesc(i)={[desc{i} ' cdf']};
-    end
-end
-
-%  draw the line plot
-
-%  (see "Using Multiple X- and Y-Axes" and "Overlaying Other
-%  Plots on Bar Graphs", or search on "YAxisLocation right")
-
-%hold all
-%hold on
-%plot(edges,cdf)
-%plotyy([],[],edges,cdf)
-
-%  ticks from the bar plot will show through, so make ticks
-%  from the line plot match
-
-nytick=length(get(ax1,'YTick'));
-ytmax =ceil(max(max(cdf))/0.1-0.1)*0.1;
-ytinc =ytmax/(nytick-1-1);
-
-ax2=axes('Position',get(ax1,'Position'),...
-         'XLim',get(ax1,'XLim'),...
-         'YLim',[0 ytinc*(nytick-1)],...
-         'YTick',[0:ytinc:ytinc*(nytick-1)],...
-         'XAxisLocation','bottom','YAxisLocation','right',...
-         'Color','none','Layer','top');
-hl2=line(edges(1:end-1),cdf(1:end-1,:),'Parent',ax2);
-       
-%  add the annotation
-
-ylabel('Cumulative Percent')
-
-% legend doesn't combine with bar chart above
-if exist('cdesc','var')
-    hleg2=legend(ax2,cdesc,'Location','NorthEast',...
-                 'Interpreter','none');
-    set(hleg2,'Color','white')
-else
-    hleg2=legend(ax2);
-    set(hleg2,'Color','white')
-end
-
-set(gcf,'PaperPositionMode','auto')
-%hold off
-
-end
Index: /issm/trunk/src/m/utils/Math/isnans.m
===================================================================
--- /issm/trunk/src/m/utils/Math/isnans.m	(revision 2241)
+++ /issm/trunk/src/m/utils/Math/isnans.m	(revision 2242)
@@ -9,4 +9,6 @@
 if isstruct(array), 
 	returnvalue=0;
+elseif iscell(array)
+	returnvalue=0;
 else
 	returnvalue=isnan(array);
