Index: /issm/trunk/src/m/classes/@pairoptions/addfielddefault.m
===================================================================
--- /issm/trunk/src/m/classes/@pairoptions/addfielddefault.m	(revision 2439)
+++ /issm/trunk/src/m/classes/@pairoptions/addfielddefault.m	(revision 2439)
@@ -0,0 +1,12 @@
+function pairoptions=addfielddefault(pairoptions,field,value),
+%ADDFIELDDEFAULT - add a field to an options list if it does not exist
+%
+%   Usage:
+%      pairoptions=addfielddefault(pairoptions,field,value)
+
+if ischar(field),
+	if ~exist(pairoptions,field),
+		pairoptions.list{end+1,1}=field;
+		pairoptions.list{end,2}=value;
+	end
+end
Index: /issm/trunk/src/m/classes/@pairoptions/exist.m
===================================================================
--- /issm/trunk/src/m/classes/@pairoptions/exist.m	(revision 2438)
+++ /issm/trunk/src/m/classes/@pairoptions/exist.m	(revision 2439)
@@ -15,3 +15,3 @@
 
 %Recover option
-bool=ismember(field,pairoptions.list(:,1));
+bool=any(strcmpi(field,pairoptions.list(:,1)));
Index: /issm/trunk/src/m/classes/@pairoptions/fieldoccurences.m
===================================================================
--- /issm/trunk/src/m/classes/@pairoptions/fieldoccurences.m	(revision 2439)
+++ /issm/trunk/src/m/classes/@pairoptions/fieldoccurences.m	(revision 2439)
@@ -0,0 +1,14 @@
+function num=fieldoccurences(pairoptions,field),
+%FIELDOCCURENCES - get number of occurence of a field
+%
+%   Usage:
+%      num=fieldoccurences(pairoptions,field);
+
+
+%check input 
+if ~ischar(field),
+	error('fieldoccurences error message: field should be a string');
+end
+
+%get number of occurence
+num=sum(strcmpi(field,pairoptions.list(:,1)));
Index: /issm/trunk/src/m/classes/@pairoptions/removefield.m
===================================================================
--- /issm/trunk/src/m/classes/@pairoptions/removefield.m	(revision 2439)
+++ /issm/trunk/src/m/classes/@pairoptions/removefield.m	(revision 2439)
@@ -0,0 +1,23 @@
+function pairoptions=removefield(pairoptions,field,warn)
+%REMOVEFIELD - delete a field in an option list
+%
+%   Usage:
+%      pairoptions=removefield(pairoptions,field,warn)
+%
+%   if warn==1 display an info message to wan user that
+%   some of his options have been removed.
+
+%check is field exist
+if exist(pairoptions,field),
+
+	%find where the field is located
+	lines=find(strcmpi(pairoptions.list(:,1),field));
+
+	%remove duplicates from the options list
+	pairoptions.list=pairoptions.list(lines,:);
+
+	%warn user if requested
+	if warn & ~isempty(lines),
+		disp(['removefield info: option ' field ' has been removed from the list of options.'])
+	end
+end
Index: /issm/trunk/src/m/classes/@plotoptions/buildlist.m
===================================================================
--- /issm/trunk/src/m/classes/@plotoptions/buildlist.m	(revision 2438)
+++ /issm/trunk/src/m/classes/@plotoptions/buildlist.m	(revision 2439)
@@ -13,4 +13,7 @@
 rawoptions=pairoptions(varargin{:});
 
+%get figure number
+plotoptions.figurenumber=getfieldvalue(rawoptions,'figure',1);
+
 %get number of data to be plotted
 numberofplots=fieldoccurences(rawoptions,'data');
@@ -26,14 +29,6 @@
 for i=1:size(rawoptions.list,1),
 
-	%option ends by #all
-	if  strncmpi(fliplr(rawoptions.list{i,1}),fliplr('#all'),4),
-
-		%Assign to all subplots
-		for j=1:numberofplots,
-			plotoptions.list{j}=addfield(plotoptions.list{j},rawoptions.list{i,1},rawoptions.list{i,2});
-		end
-
-	%option ends by #i
-	elseif ismember('#',rawoptions.list{i,1}),
+	%option contains '#'
+	if ismember('#',rawoptions.list{i,1}),
 
 		%get suplot(s) associated
@@ -42,6 +37,14 @@
 		field=string{1};
 
-		%assign to subplot
-		plotoptions.list{str2num(plotnum)}=addfield(plotoptions.list{str2num(plotnum)},field,rawoptions.list{i,2});
+		%#all
+		if strcmpi(plotnum,'all');
+			for j=1:numberofplots,
+				plotoptions.list{j}=addfield(plotoptions.list{j},field,rawoptions.list{i,2});
+			end
+		%#i
+		else
+			%assign to subplot
+			plotoptions.list{str2num(plotnum)}=addfield(plotoptions.list{str2num(plotnum)},field,rawoptions.list{i,2});
+		end
 
 	%assign option field to corresponding subplot
@@ -63,2 +66,7 @@
 	end
 end
+
+%check that there is no duplicates
+for i=1:numberofplots,
+	plotoptions.list{i}=deleteduplicates(plotoptions.list{i},1);
+end
Index: /issm/trunk/src/m/classes/@plotoptions/display.m
===================================================================
--- /issm/trunk/src/m/classes/@plotoptions/display.m	(revision 2438)
+++ /issm/trunk/src/m/classes/@plotoptions/display.m	(revision 2439)
@@ -6,4 +6,5 @@
 disp(sprintf('\n%s = \n',inputname(1)));
 disp(sprintf('   numberofplots: %i',plotoptions.numberofplots));
+disp(sprintf('   figurenumber: %i',plotoptions.figurenumber));
 if ~isempty(plotoptions.list),
 	disp(sprintf('   list: (%ix%i)',size(plotoptions.list,1),size(plotoptions.list,2)));
Index: /issm/trunk/src/m/classes/@plotoptions/plotoptions.m
===================================================================
--- /issm/trunk/src/m/classes/@plotoptions/plotoptions.m	(revision 2438)
+++ /issm/trunk/src/m/classes/@plotoptions/plotoptions.m	(revision 2439)
@@ -13,4 +13,5 @@
 
 options.numberofplots=0;
+options.figurenumber=1;
 options.list=cell(0,0);
 options=class(options,'plotoptions');
Index: /issm/trunk/src/m/classes/@plotoptions/subsref.m
===================================================================
--- /issm/trunk/src/m/classes/@plotoptions/subsref.m	(revision 2439)
+++ /issm/trunk/src/m/classes/@plotoptions/subsref.m	(revision 2439)
@@ -0,0 +1,10 @@
+function plotoptions = subsref(plotoptions,index)
+%SUBSREF - handles indexed references to objects
+%
+%   the first argument is the object and the second one a structure array
+%   Usage:
+%      plotoptions = subsref(plotoptions,index)
+% 
+%   See also SUBSASGN
+
+plotoptions=builtin('subsref',plotoptions,index);
Index: /issm/trunk/src/m/classes/public/parametercontrol.m
===================================================================
--- /issm/trunk/src/m/classes/public/parametercontrol.m	(revision 2438)
+++ /issm/trunk/src/m/classes/public/parametercontrol.m	(revision 2439)
@@ -29,7 +29,7 @@
 
 %cm_max
-cm_max=getfieldvalue(options,'cm_max',180);
+cm_max=getfieldvalue(options,'cm_max',250);
 if (length(cm_max)~=1)
-	md.cm_max=180;
+	md.cm_max=250;
 else
 	md.cm_max=cm_max;
@@ -37,9 +37,37 @@
 
 %cm_noisedmp
-cm_noisedmp=getfieldvalue(options,'cm_noisedmp',5*10^-5);
+cm_noisedmp=getfieldvalue(options,'cm_noisedmp',5*10^-7);
 if (length(cm_noisedmp)~=1)
-	md.cm_noisedmp=5*10^-5;
+	md.cm_noisedmp=5*10^-7;
 else
 	md.cm_noisedmp=cm_noisedmp;
+end
+
+%cm_maxdmp
+cm_maxdmp_value=getfieldvalue(options,'cm_maxdmp_value',50);
+if (length(cm_maxdmp_value)~=1)
+	md.cm_maxdmp_value=150;
+else
+	md.cm_maxdmp_value=cm_maxdmp_value;
+end
+cm_maxdmp_slope=getfieldvalue(options,'cm_maxdmp_slope',10^-13);
+if (length(cm_maxdmp_slope)~=1)
+	md.cm_maxdmp_slope=10^-13;
+else
+	md.cm_maxdmp_slope=cm_maxdmp_slope;
+end
+
+%cm_mindmp
+cm_mindmp_value=getfieldvalue(options,'cm_mindmp_value',1);
+if (length(cm_mindmp_value)~=1)
+	md.cm_mindmp_value=1;
+else
+	md.cm_mindmp_value=cm_mindmp_value;
+end
+cm_mindmp_slope=getfieldvalue(options,'cm_mindmp_slope',0);
+if (length(cm_mindmp_slope)~=1)
+	md.cm_mindmp_slope=0;
+else
+	md.cm_mindmp_slope=cm_mindmp_slope;
 end
 
@@ -98,5 +126,5 @@
 if ~found
 	third=ceil(md.nsteps/3);
-	md.optscal=[15*ones(third,1);10*ones(third,1);repmat([10;10;20;10],third,1)];
+	md.optscal=[50*ones(3,1);15*ones(third-3,1);10*ones(third,1);repmat([10;10;20;10],third,1)];
 	md.optscal(md.nsteps+1:end)=[];
 end
Index: /issm/trunk/src/m/classes/public/plot/applyoptions.m
===================================================================
--- /issm/trunk/src/m/classes/public/plot/applyoptions.m	(revision 2438)
+++ /issm/trunk/src/m/classes/public/plot/applyoptions.m	(revision 2439)
@@ -1,119 +1,113 @@
-function applyoptions(md,data,options_structure)
+function applyoptions(md,data,options)
 %APPLYOPTIONS - apply the options to current plot
 %
 %   Usage:
-%      applyoptions(md,data,options_structure)
+%      applyoptions(md,data,options)
 %
 %   See also: PLOTMODEL, PARSE_OPTIONS
 
 %fontsize
-if ~isnan(options_structure.fontsize),
-	fontsize=options_structure.fontsize;
-else
-	fontsize=14;
-end
+fontsize=getfieldvalue(options,'fontsize',14);
 
 %fontweight
-if ~isnan(options_structure.fontweight),
-	fontweight=options_structure.fontweight;
-else
-	fontweight='normal';
-end
+fontweight=getfieldvalue(options,'fontweight','normal');
 
 %title
-if iscell(options_structure.title),
-	title(options_structure.title,'FontSize',fontsize,'FontWeight',fontweight);
-else
-	if ~isnan(options_structure.title),
-		title(options_structure.title,'FontSize',fontsize,'FontWeight',fontweight);
+if exist(options,'title')
+	titlevalue=getfieldvalue(options,'title');
+	if iscell(titlevalue),
+		title(titlevalue,'FontSize',fontsize,'FontWeight',fontweight);
+	else
+		if ~isnan(titlevalue),
+			title(titlevalue,'FontSize',fontsize,'FontWeight',fontweight);
+		end
 	end
 end
 
 %xlabel
-if ~isnan(options_structure.xlabel),
-	xlabel(options_structure.xlabel,'FontSize',fontsize,'FontWeight',fontweight);
+if exist(options,'xlabel');
+	xlabel(getfieldvalue(options,'xlabel'),'FontSize',fontsize,'FontWeight',fontweight);
 end
 
 %ylabel
-if ~isnan(options_structure.ylabel),
-	ylabel(options_structure.ylabel,'FontSize',fontsize,'FontWeight',fontweight);
+if exist(options,'ylabel');
+	ylabel(getfieldvalue(options,'ylabel'),'FontSize',fontsize,'FontWeight',fontweight);
 end
 
 %zlabel
-if ~isnan(options_structure.zlabel),
-	zlabel(options_structure.zlabel,'FontSize',fontsize,'FontWeight',fontweight);
+if exist(options,'zlabel');
+	zlabel(getfieldvalue(options,'zlabel'),'FontSize',fontsize,'FontWeight',fontweight);
 end
 
 %view 
-if ~isnan(options_structure.view),
-	view(options_structure.view);
+if strcmpi(md.type,'3d') & ~exist(options,'layer'),
+	view(getfieldvalue(options,'view',3));
 else
-	if strcmpi(md.type,'3d') & isnan(options_structure.layer),
-		view(3);
-	else
-		view(2);
+	view(getfieldvalue(options,'view',2));
+end
+
+%xlim
+if exist(options,'xlim');
+	xlim(getfieldvalue(options,'xlim'));
+end
+
+%ylim
+if exist(options,'ylim');
+	ylim(getfieldvalue(options,'ylim'));
+end
+
+%zlim
+if exist(options,'zlim');
+	zlim(getfieldvalue(options,'zlim'));
+end
+
+%Basinzoom
+if exist(options,'basinzoom');
+	basinzoom(getfieldvalue(options,'basinzoom'),getfieldvalue(options,'unit',1));
+end
+
+%Caxis
+if exist(options,'caxis'),
+	caxis(getfieldvalue(options,'caxis'));
+end
+
+%shading
+if exist(options,'shading'),
+	shading(getfieldvalue(options,'shading'));
+end
+
+%grid
+if exist(options,'grid'),
+	if strcmpi(getfieldvalue(options,'grid'),'on'),
+		grid on;
 	end
 end
 
-%xlim
-if ~isnan(options_structure.xlim),
-	xlim(options_structure.xlim);
-end
-
-%ylim
-if ~isnan(options_structure.ylim),
-	ylim(options_structure.ylim);
-end
-
-%zlim
-if ~isnan(options_structure.zlim),
-	zlim(options_structure.zlim);
-end
-
-%Basinzoom
-if ~isnan(options_structure.basinzoom),                                                                                                                         
-	basinzoom(options_structure.basinzoom,options_structure.unitmultiplier);                                                                                                                          end
-
-%Caxis
-if ~isnan(options_structure.caxis),
-	caxis(options_structure.caxis);
-end
-
-%shading
-if ~isnan(options_structure.shading),
-	shading(options_structure.shading);
-end
-
-%grid
-if ~isnan(options_structure.grid) & strcmpi(options_structure.grid,'on'),
-	grid on;
-end
-
 %colormap
-if ~isnan(options_structure.colormap),
-	h=colormap(options_structure.colormap);
+if exist(options,'colormap'),
+	h=colormap(getfieldvalue(options,'colormap'));
 end
 
 %wrapping
-if ~isnan(options_structure.wrapping),
-	if  isnan(options_structure.colormap)
+if exist(options,'wrapping'),
+	if ~exist(options,'colormap'),
 		h=jet;
 	end
-	colormap(repmat(h,options_structure.wrapping,1));
+	colormap(repmat(h,getfieldvalue(options,'wrapping',1)));
 end
 
 %colorbar
-if options_structure.colorbar~=0,
+if getfieldvalue(options,'colorbar',1)~=0,
 	c=colorbar;set(c,'FontSize',fontsize);
-	if ~isnan(options_structure.wrapping)
+	if exist(options,'wrapping')
 		lim=get(c,'Ylim');
-		lim=[lim(1) lim(1)+(lim(2)-lim(1))/options_structure.wrapping];
+		lim=[lim(1) lim(1)+(lim(2)-lim(1))/getfieldvalue(options,'wrapping')];
 		set(c,'Ylim',lim);
 	end
-	if ~isnan(options_structure.colorbarpos),
-		set(c,'Position',options_structure.colorbarpos);
+	if exist(options,'colorbarpos'),
+		set(c,'Position',getfieldvalue(options,'colorbarpos'));
 	end
-	if ~isnan(options_structure.log),
-		logvalue=options_structure.log;
+	if exist(options,'log'),
+		logvalue=getfieldvalue(options,'log');
 
 		scalestring=get(c,'YTickLabel');
@@ -131,7 +125,7 @@
 		set(c,'FontSize',fontsize);
 	end
-	if ~isnan(options_structure.colorbartitle),
+	if exist(options,'colorbartitle'),
 		backup=gca;
-		axes(c);lab=ylabel(options_structure.colorbartitle);set(lab,'Rotation',-90);set(lab,'VerticalAlignment','bottom');
+		axes(c);lab=ylabel(getfieldvalue(options,'colorbartitle'));set(lab,'Rotation',-90);set(lab,'VerticalAlignment','bottom');
 		axes(backup);
 	end
@@ -142,56 +136,59 @@
 
 %area
-if ~isnan(options_structure.area),
-	antzoom(options_structure.area);
+if exist(options,'area'),
+	antzoom(getfieldvalue(options,'area'));
 end
 
 %expdisp
-if iscell(options_structure.expdisp) | ~isnan(options_structure.expdisp),
-	for i=1:length(options_structure.expdisp),
-		filename=options_structure.expdisp{i};
-		style=options_structure.expstyle{i};
-		expdisp(filename,gcf,style,options_structure.unitmultiplier);
-	end
+filename=(getfieldvalue(options,'expdisp'));
+style=(getfieldvalue(options,'expstyle'));
+for i=1:length(getfieldvalue(options,'expdisp')),
+	filenamei=filename{i};
+	stylei=style{i};
+	expdisp(filenamei,gcf,stylei,getfieldvalue(options,'unit',1));
 end
 
 %text (default value is empty, not NaN...)
-if ~isempty(options_structure.text)
-	for i=1:length(options_structure.text);
-		textstring=options_structure.text{i};
-		textweight=options_structure.textweight{i};
-		textsize=options_structure.textsize{i};
-		textcolor=options_structure.textcolor{i};
-		textposition=options_structure.textposition{i};
-		text(textposition(1),textposition(2),textstring,'FontSize',textsize,'FontWeight',textweight,'Color',textcolor);
-	end
+textstring=getfieldvalue(options,'text');
+textweight=getfieldvalue(options,'textweight');
+textsize=getfieldvalue(options,'textsize');
+textcolor=getfieldvalue(options,'textcolor');
+textposition=getfieldvalue(options,'textposition');
+for i=1:length(getfieldvalue(options,'text'));
+	textstringi=textstring{i};
+	textweighti=textweight{i};
+	textsizei=textsize{i};
+	textcolori=textcolor{i};
+	textpositioni=textposition{i};
+	text(textpositioni(1),textpositioni(2),textstringi,'FontSize',textsizei,'FontWeight',textweighti,'Color',textcolori);
 end
 
 %latlon
-if (iscell(options_structure.latlon) | ~isnan(options_structure.latlon)),
-	latlonoverlay(options_structure);
+if exist(options,'latlon')
+	latlonoverlay(options);
 end
 
 %north arrow
-if ~isnan(options_structure.northarrow),
-	northarrow(options_structure.northarrow);
+if exist(options,'northarrow'),
+	northarrow(getfieldvalue(options,'northarrow'));
 end
 
 %Scale ruler
-if ~isnan(options_structure.scaleruler),
-	scaleruler(options_structure.scaleruler);
+if exist(options,'scaleruler'),
+	scaleruler(getfieldvalue(options,'scaleruler'));
 end
 
 %axis
-if ~isnan(options_structure.axis)
-	eval(['axis ' options_structure.axis]);
+if exist(options,'axis')
+	eval(['axis ' getfieldvalue(options,'axis')]);
 end
 
 %streamliness
-if iscell(options_structure.streamlines) | ~isnan(options_structure.streamlines),
-	plot_streamlines(md,options_structure);
+if exist(options,'streamlines'),
+	plot_streamlines(md,options);
 end
 
 %contours
-if iscell(options_structure.contourlevels) | ~isnan(options_structure.contourlevels),
-	plot_contour(md,data,options_structure);
+if exist(options,'contourlevels'),
+	plot_contour(md,data,options);
 end
Index: /issm/trunk/src/m/classes/public/plot/checkplotoptions.m
===================================================================
--- /issm/trunk/src/m/classes/public/plot/checkplotoptions.m	(revision 2439)
+++ /issm/trunk/src/m/classes/public/plot/checkplotoptions.m	(revision 2439)
@@ -0,0 +1,215 @@
+function options=checkplotoptions(md,options);
+%PARSE_OPTIONS - build a structure that holds all plot options
+%
+%   Usage:
+%      options=checkplotoptions(md,options);
+%
+%   See also: PLOTMODEL
+
+%units
+if exist(options,'unit'),
+	if strcmpi(getfieldvalue(options,'unit'),'km')
+		options=changefieldvalue(options,'unit',10^-3);
+	end
+end
+
+%density
+if exist(options,'density'),
+	density=getfieldvalue(options,'density');
+	options=changefieldvalue(options,'density',abs(ceil(density)));
+end
+
+%Show section
+if exist(options,'showsection'),
+	if strcmpi(getfieldvalue(options,'showsection'),'on')
+		options=changefieldvalue(options,'showsection',4);
+	end
+end
+
+%iceshelf values
+if exist(options,'iceshelf'),
+	if strcmpi(getfieldvalue(options,'iceshelf'),'none')
+		options=changefieldvalue(options,'iceshelf',0);
+	end
+end
+
+%icesheet values
+if exist(options,'icesheet'),
+	if strcmpi(getfieldvalue(options,'icesheet'),'none')
+		options=changefieldvalue(options,'icesheet',0);
+	end
+end
+
+%water values
+if exist(options,'water'),
+	if strcmpi(getfieldvalue(options,'water'),'none')
+		options=changefieldvalue(options,'water',0);
+	end
+end
+
+%smooth values
+if exist(options,'smooth'),
+	if strcmpi(getfieldvalue(options,'smooth'),'on')
+		options=changefieldvalue(options,'smooth',0);
+	end
+end
+
+%contouronly values
+if exist(options,'contouronly'),
+	if strcmpi(getfieldvalue(options,'contouronly'),'on')
+		options=changefieldvalue(options,'contouronly',1);
+	end
+end
+
+
+%Colorbar;
+if exist(options,'colorbar'),
+	if strcmpi(getfieldvalue(options,'colorbar'),'on')
+		options=changefieldvalue(options,'colorbar',1);
+	elseif strcmpi(getfieldvalue(options,'colorbar'),'off')
+			options=changefieldvalue(options,'colorbar',0);
+	end
+end
+	
+%text
+%1: textsize
+textsizevaluesarray=cell(0,0);
+if exist(options,'textsize'),
+	textsizevalues=getfieldvalue(options,'textsize');
+	%ischar if only one textsize -> create a cell
+	if ischar(textsizevalues),
+		textsizevalues={textsizevalues};
+	end
+else
+	textsizevalues={14};
+end
+%2: textweight
+textweightvaluesarray=cell(0,0);
+if exist(options,'textweight'),
+	textweightvalues=getfieldvalue(options,'textweight');
+	%ischar if only one textweight -> create a cell
+	if ischar(textweightvalues),
+		textweightvalues={textweightvalues};
+	end
+else
+	textweightvalues={'n'};
+end
+%3: textcolor
+textcolorvaluesarray=cell(0,0);
+if exist(options,'textcolor'),
+	textcolorvalues=getfieldvalue(options,'textcolor');
+	%ischar if only one textcolor -> create a cell
+	if ischar(textcolorvalues),
+		textcolorvalues={textcolorvalues};
+	end
+else
+	textcolorvalues={'k'};
+end
+%4: textposition
+textpositionvaluesarray=cell(0,0);
+if exist(options,'textposition'),
+	textpositionvalues=getfieldvalue(options,'textposition');
+	%isnumeric if only one textposition -> create a cell
+	if isnumeric(textpositionvalues),
+		textpositionvalues={textpositionvalues};
+	end
+end
+%5: textvalue
+textvaluesarray=cell(0,0);
+if exist(options,'text'),
+	textvalues=getfieldvalue(options,'text');
+	%ischar if only one expstyle -> create a cell
+	if ischar(textvalues),
+		textvalues={textvalues};
+	end
+	%get options
+	for i=1:length(textvalues)
+		textvaluesarray{end+1}=textvalues{i};
+		%size
+		if (length(textsizevalues)>=i),
+			textsizevaluesarray{end+1}=textsizevalues{i};
+		else
+			textsizevaluesarray{end+1}=textsizevalues{1};
+		end
+		%weight
+		if (length(textweightvalues)>=i),
+			textweightvaluesarray{end+1}=textweightvalues{i};
+		else
+			textweightvaluesarray{end+1}=textweightvalues{1};
+		end
+		%color
+		if (length(textcolorvalues)>=i),
+			textcolorvaluesarray{end+1}=textcolorvalues{i};
+		else
+			textcolorvaluesarray{end+1}=textcolorvalues{1};
+		end
+		%position
+		if (length(textpositionvalues)>=i),
+			textpositionvaluesarray{end+1}=textpositionvalues{i};
+		else
+			error('plotmodel error message: one or more textposition is missing');
+		end
+	end
+end
+options=changefieldvalue(options,'text',textvaluesarray);
+options=changefieldvalue(options,'textsize',textsizevaluesarray);
+options=changefieldvalue(options,'textweight',textweightvaluesarray);
+options=changefieldvalue(options,'textcolor',textcolorvaluesarray);
+options=changefieldvalue(options,'textposition',textpositionvaluesarray);
+
+%expdisp
+expdispvaluesarray=cell(0,0);
+expstylevaluesarray=cell(0,0);
+if exist(options,'expstyle'),
+	expstylevalues=getfieldvalue(options,'expstyle');
+	%ischar if only one expstyle -> create a cell
+	if ischar(expstylevalues),
+		expstylevalues={expstylevalues};
+	end
+end
+if exist(options,'expdisp'),
+	expdispvalues=getfieldvalue(options,'expdisp');
+	%ischar if only one expstyle -> create a cell
+	if ischar(expdispvalues),
+		expdispvalues={expdispvalues};
+	end
+	for i=1:length(expdispvalues)
+		expdispvaluesarray{end+1}=expdispvalues{i};
+		if (length(expstylevalues)>=i),
+			expstylevaluesarray{end+1}=expstylevalues{i};
+		else
+			expstylevaluesarray{end+1}='g-';
+		end
+	end
+end
+options=changefieldvalue(options,'expstyle',expstylevaluesarray);
+options=changefieldvalue(options,'expdisp',expdispvaluesarray);
+
+%latlonnumbering
+if exist(options,'latlonclick'),
+	if strcmpi(getfieldvalue(options,'latlonclick'),'on')
+		options=changefieldvalue(options,'latlonclick',1);
+	end
+end
+
+%north arrow
+if exist(options,'northarrow'),
+	if strcmpi(getfieldvalue(options,'northarrow'),'on')
+		%default values
+		Lx=max(md.y)-min(md.y);
+		Ly=max(md.y)-min(md.y);
+		%default values
+		options=changefieldvalue(options,'northarrow',[min(md.x)+1/6*Lx   min(md.y)+5/6*Ly   1/15*Ly   0.25   1/250*Ly]);
+	end
+end
+
+%scale ruler
+if exist(options,'scaleruler'),
+	if strcmpi(getfieldvalue(options,'scaleruler'),'on')
+		%default values
+		Lx=max(md.y)-min(md.y);
+		Ly=max(md.y)-min(md.y);
+		%default values
+		options=changefieldvalue(options,'scaleruler',[min(md.x)+6/8*Lx   min(md.y)+1/10*Ly   10^(ceil(log10(Lx)))/5 floor(Lx/100) 5]);
+	end
+end
Index: /issm/trunk/src/m/classes/public/plot/latlonoverlay.m
===================================================================
--- /issm/trunk/src/m/classes/public/plot/latlonoverlay.m	(revision 2438)
+++ /issm/trunk/src/m/classes/public/plot/latlonoverlay.m	(revision 2439)
@@ -1,3 +1,3 @@
-function latlonoverlay(options_structure)
+function latlonoverlay(options)
 %LATLONOVERLAY - overlay latitude and longitude lines on current figure
 %
@@ -8,19 +8,11 @@
 %
 %   Usage:
-%      latlonoverlay(options_structure)
+%      latlonoverlay(options)
 
 %get options
-latlon=options_structure.latlon;
-numbering=options_structure.latlonnumbering;
-if ~isnan(options_structure.latlonclick),
-	latlonclick=1;
-else
-	latlonclick=0;
-end
-if ~isnan(options_structure.fontsize),
-	fontsize=options_structure.fontsize;
-else
-	fontsize=16;
-end
+latlon=getfieldvalue(options,'latlon');
+numbering=getfieldvalue(options,'latlonnumbering');
+latlonclick=getfieldvalue(options,'latlonclick',0);
+fontsize=getfieldvalue(options,'fontsize',16);
 
 %recover arguments (set default parameters if needed)
Index: /issm/trunk/src/m/classes/public/plot/plot_basaldrag.m
===================================================================
--- /issm/trunk/src/m/classes/public/plot/plot_basaldrag.m	(revision 2438)
+++ /issm/trunk/src/m/classes/public/plot/plot_basaldrag.m	(revision 2439)
@@ -1,7 +1,8 @@
-function plot_basaldrag(md,options_structure,width,i,type);
+function plot_basaldrag(md,options,width,i,type);
+
 %PLOT_BASALDRAG - plot basal drag
 %
 %   Usage:
-%      plot_basaldrag(md,options_structure,width,i,type);
+%      plot_basaldrag(md,options,width,i,type);
 %
 %   See also: PLOTMODEL
@@ -9,7 +10,7 @@
 %check layer
 if strcmpi(md.type,'3d')
-	if options_structure.layer~=1,
+	if getfieldvalue(options,'layer',1)~=1;
 		disp('plot_basaldrag warning: basal drag is displayed in the lower layer')
-		options_structure.layer=1;
+		changefieldvalue(options,'layer',1);
 	end
 end
@@ -32,25 +33,21 @@
 
 %Figure out if this is a Section plot
-if ~isnan(options_structure.sectionvalue)
-	plot_section(md,drag,options_structure,width,i);
+if exist(options,'sectionvalue')
+	plot_section(md,drag,options,width,i);
 	return;
 else
 
 	%process data and model
-	[x y z elements is2d]=processmesh(md,options_structure);
-	[basal_drag isongrid isquiver]=processdata(md,drag,options_structure);
+	[x y z elements is2d]=processmesh(md,options);
+	[basal_drag isongrid isquiver]=processdata(md,drag,options);
 
 	%plot basaldrag
 	subplot(width,width,i); 
-	plot_unit(x,y,z,elements,basal_drag,isongrid,is2d,isquiver,options_structure);
+	plot_unit(x,y,z,elements,basal_drag,isongrid,is2d,isquiver,options);
 
 	%apply options
-	if isnan(options_structure.title)
-		options_structure.title='Basal drag [kPa]';
-	end 
-	if isnan(options_structure.view)
-		options_structure.view=2;
-	end
-	applyoptions(md,basal_drag,options_structure);
+	options=addfielddefault(options,'title','Basal drag [kPa]');
+	options=addfielddefault(options,'view',2);
+	applyoptions(md,basal_drag,options);
 
 end
Index: /issm/trunk/src/m/classes/public/plot/plot_boundaries.m
===================================================================
--- /issm/trunk/src/m/classes/public/plot/plot_boundaries.m	(revision 2438)
+++ /issm/trunk/src/m/classes/public/plot/plot_boundaries.m	(revision 2439)
@@ -1,7 +1,7 @@
-function plot_boundaries(md,options_structure,width,i);
+function plot_boundaries(md,options,width,i);
 %PLOT_BOUNDARIES - plot mesh boundaries
 %
 %   Usage:
-%      plot_boundaries(md,options_structure,width,i);
+%      plot_boundaries(md,options,width,i);
 %
 %   See also: PLOTMODEL
@@ -10,9 +10,8 @@
 
 %process data and model
-if ~isnan(options_structure.layer)
-	disp('plotmodel warning: layer projection not supported yet by plot_boundaries');
-	options_structure.layer=NaN;
+if getfieldvalue(options,'layer',0)
+	options=removefield(options,'layer',1);
 end
-[x y z elements is2d]=processmesh(md,options_structure);
+[x y z elements is2d]=processmesh(md,options);
 
 for i=1:size(md.segments,1),
@@ -35,12 +34,6 @@
 
 %apply options
-if isnan(options_structure.title)
-	options_structure.title='Mesh boundaries';
-end
-if isnan(options_structure.colorbar)
-	options_structure.colorbar=0;
-end
-if isnan(options_structure.view)
-	options_structure.view=2;
-end
-applyoptions(md,[],options_structure);
+options=addfielddefault(options,'title','Mesh boundaries');
+options=addfielddefault(options,'colorbar',0);
+options=addfielddefault(options,'view',2);
+applyoptions(md,[],options);
Index: /issm/trunk/src/m/classes/public/plot/plot_contour.m
===================================================================
--- /issm/trunk/src/m/classes/public/plot/plot_contour.m	(revision 2438)
+++ /issm/trunk/src/m/classes/public/plot/plot_contour.m	(revision 2439)
@@ -1,13 +1,13 @@
-function plot_contour(md,datain,options_structure);
+function plot_contour(md,datain,options);
 %PLOT_CONTOUR - plot contours of a given field
 %
 %   Usage:
-%      plot_contour(md,data,options_structure);
+%      plot_contour(md,data,options);
 %
 %   See also: PLOTMODEL
 
 %process data and model
-[x y z index is2d]=processmesh(md,options_structure);
-[data isongrid isquiver]=processdata(md,datain,options_structure);
+[x y z index is2d]=processmesh(md,options);
+[data isongrid isquiver]=processdata(md,datain,options);
 
 %check is2d
@@ -27,22 +27,18 @@
 
 %prepare colors
-if isnan(options_structure.contouronly)
-	%contour color
-	if isnan(options_structure.contourcolor)
-		options_structure.contourcolor='y';
-	end
-else
+if exist(options,'contouronly')
 	%remove the previous plots
 	cla
 end
-color=options_structure.contourcolor;
+color=getfieldvalue(options,'contourcolor','y');
 
 %get contours levels
-if isnumeric(options_structure.contourlevels),
-	levels=round_ice(linspace(max(data),min(data),options_structure.contourlevels),2);
+contourlevels=getfieldvalue(options,'contourlevels');
+if isnumeric(contourlevels),
+	levels=round_ice(linspace(max(data),min(data),contourlevels),2);
 else
 	levels=[];
-	for i=1:length(options_structure.contourlevels)
-		levels(end+1)=options_structure.contourlevels{i};
+	for i=1:length(contourlevels)
+		levels(end+1)=contourlevels{i};
 	end
 	levels=sort(unique(levels),'descend');
@@ -220,5 +216,5 @@
 		%we now have one subcontour ready to be plotted
 		zc=level*ones(length(xc)+1,1);
-		if isnan(color),
+		if getfieldvalue(options,'contouronly',0),
 			h=[h;patch('Xdata',[xc;NaN],'Ydata',[yc;NaN],'Zdata',zc,'Cdata',zc,'facecolor','none','edgecolor','flat')];
 			hold on      
@@ -236,9 +232,9 @@
 
 %labels?
-if (~strcmpi(options_structure.contourticks,'off') & ~isempty(c) & ~isempty(h))
-	if ~isnan(options_structure.contourcolor)
+if (~strcmpi(getfieldvalue(options,'contourticks','on'),'off') & ~isempty(c) & ~isempty(h))
+	if exist(options,'contouronly')
+		clabel(c,h);
+	else
 		clabel(c,h,'color',color,'FontSize',14);
-	else
-		clabel(c,h);
-	end
-end
+	end
+end
Index: /issm/trunk/src/m/classes/public/plot/plot_drivingstress.m
===================================================================
--- /issm/trunk/src/m/classes/public/plot/plot_drivingstress.m	(revision 2438)
+++ /issm/trunk/src/m/classes/public/plot/plot_drivingstress.m	(revision 2439)
@@ -1,7 +1,7 @@
-function plot_drivingstress(md,options_structure,width,i);
+function plot_drivingstress(md,options,width,i);
 %PLOT_DRIVINGSTRESS - plot driving stress
 %
 %   Usage:
-%      plot_drivingstress(md,options_structure,width,i);
+%      plot_drivingstress(md,options,width,i);
 %
 %   See also: PLOTMODEL, PLOT_UNIT, PLOT_MANAGER
@@ -11,18 +11,14 @@
 
 %process data and model
-[x y z elements is2d]=processmesh(md,options_structure);
-[dstress isongrid isquiver]=processdata(md,s,options_structure);
+[x y z elements is2d]=processmesh(md,options);
+[dstress isongrid isquiver]=processdata(md,s,options);
 dstress=dstress/1000;
 
 %plot mesh quivervel
 subplot(width,width,i); 
-plot_unit(x,y,z,elements,dstress,isongrid,is2d,isquiver,options_structure)
+plot_unit(x,y,z,elements,dstress,isongrid,is2d,isquiver,options)
 
 %apply options
-if isnan(options_structure.title)
-	options_structure.title='Driving stress [kPa]';
-end 
-if isnan(options_structure.view)
-	options_structure.view=2;
-end 
-applyoptions(md,dstress,options_structure);
+options=addfielddefault(options,'title','Driving stress [kPa]');
+options=addfielddefault(options,'view',2);
+applyoptions(md,dstress,options);
Index: /issm/trunk/src/m/classes/public/plot/plot_elementnumbering.m
===================================================================
--- /issm/trunk/src/m/classes/public/plot/plot_elementnumbering.m	(revision 2438)
+++ /issm/trunk/src/m/classes/public/plot/plot_elementnumbering.m	(revision 2439)
@@ -1,7 +1,7 @@
-function plot_elementnumbering(md,options_structure,width,i);
+function plot_elementnumbering(md,options,width,i);
 %PLOT_ELEMENTNUMBERING - plot element numbering
 %
 %   Usage:
-%      plot_elementnumbering(md,options_structure,width,i);
+%      plot_elementnumbering(md,options,width,i);
 %
 %   See also: PLOTMODEL, PLOT_UNIT, PLOT_MANAGER
@@ -10,6 +10,6 @@
 
 %process data and model
-[x y z elements is2d]=processmesh(md,options_structure);
-[elementnumbers isgrid]=processdata(md,[1:md.numberofelements]',options_structure);
+[x y z elements is2d]=processmesh(md,options);
+[elementnumbers isgrid]=processdata(md,[1:md.numberofelements]',options);
 
 %plot
@@ -20,5 +20,5 @@
 	for i=1:size(elements,1),
 		text(sum(x(elements(i,:)))/3,sum(y(elements(i,:)))/3,sum(z(elements(i,:)))/3,num2str(elementnumbers(i)));
-		if ~isnan(options_structure.highlight) & ismember(elementnumbers(i),options_structure.highlight)
+		if ismember(elementnumbers(i),getfieldvalue(options,'highlight',[]))
 			A=elements(i,1); B=elements(i,2);  C=elements(i,3);
 			patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', [0.9 0.5 0.5],'FaceColor','flat','EdgeColor','black');
@@ -35,5 +35,5 @@
 	for i=1:size(elements,1),
 		text(sum(x(elements(i,:)))/6,sum(y(elements(i,:)))/6,sum(z(elements(i,:)))/6,num2str(elementnumbers(i)));
-		if ~isnan(options_structure.highlight) & ismember(elementnumbers(i),options_structure.highlight)
+		if ismember(elementnumbers(i),getfieldvalue(options,'highlight',[]))
 			A=elements(i,1); B=elements(i,2);  C=elements(i,3);  D=elements(i,4); E=elements(i,5);  F=elements(i,6);
 			patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', [0.9 0.5 0.5],'FaceColor','flat','EdgeColor','black');
@@ -47,9 +47,5 @@
 
 %apply options
-if isnan(options_structure.title)
-	options_structure.title='Element numbering';
-end
-if isnan(options_structure.colorbar)
-	options_structure.colorbar=0;
-end
-applyoptions(md,[],options_structure);
+options=addfielddefault(options,'title','Element numbering');
+options=addfielddefault(options,'colorbar',0);
+applyoptions(md,[],options);
Index: /issm/trunk/src/m/classes/public/plot/plot_elementstype.m
===================================================================
--- /issm/trunk/src/m/classes/public/plot/plot_elementstype.m	(revision 2438)
+++ /issm/trunk/src/m/classes/public/plot/plot_elementstype.m	(revision 2439)
@@ -1,22 +1,18 @@
-function plot_elementstype(md,options_structure,width,i);
+function plot_elementstype(md,options,width,i);
 %PLOT_ELEMENTSTYPE - plot elements type
 %
 %   Usage:
-%      plot_elementstype(md,options_structure,width,i);
+%      plot_elementstype(md,options,width,i);
 %
 %   See also: PLOTMODEL
 
 %process data and model
-[x y z elements is2d]=processmesh(md,options_structure);
-[data1 isongrid isquiver]=processdata(md,md.elements_type(:,1),options_structure);
-[data2 isongrid isquiver]=processdata(md,md.elements_type(:,2),options_structure);
+[x y z elements is2d]=processmesh(md,options);
+[data1 isongrid isquiver]=processdata(md,md.elements_type(:,1),options);
+[data2 isongrid isquiver]=processdata(md,md.elements_type(:,2),options);
 data=[data1 data2];
 
 %edgecolor?
-if ~isnan(options_structure.edgecolor),
-	edgecolor=options_structure.edgecolor;
-else
-	edgecolor='none';
-end
+edgecolor=getfieldvalue(options,'edgecolor','none');
 
 %plot
@@ -88,9 +84,5 @@
 
 %apply options
-if isnan(options_structure.title)
-	options_structure.title='Elements type';
-end 
-if isnan(options_structure.colorbar)
-	options_structure.colorbar=0;
-end
-applyoptions(md,[],options_structure);
+options=addfielddefault(options,'title','Elements type');
+options=addfielddefault(options,'colorbar',0);
+applyoptions(md,[],options);
Index: /issm/trunk/src/m/classes/public/plot/plot_gridnumbering.m
===================================================================
--- /issm/trunk/src/m/classes/public/plot/plot_gridnumbering.m	(revision 2438)
+++ /issm/trunk/src/m/classes/public/plot/plot_gridnumbering.m	(revision 2439)
@@ -1,13 +1,13 @@
-function plot_gridnumbering(md,options_structure,width,i);
+function plot_gridnumbering(md,options,width,i);
 %PLOT_GRIDNUMBERING - plot grid numbering
 %
 %   Usage:
-%      plot_gridnumbering(md,options_structure,width,i);
+%      plot_gridnumbering(md,options,width,i);
 %
 %   See also: PLOTMODEL
 
 %process data and model
-[x y z elements is2d]=processmesh(md,options_structure);
-[gridnumbers isongrid isquiver]=processdata(md,[1:md.numberofgrids]',options_structure);
+[x y z elements is2d]=processmesh(md,options);
+[gridnumbers isongrid isquiver]=processdata(md,[1:md.numberofgrids]',options);
 
 %plot
@@ -21,7 +21,8 @@
 		text(x(i),y(i), z(i),num2str(gridnumbers(i)),'backgroundcolor',[0.8 0.9 0.8]);
 	end
-	if ~isnan(options_structure.highlight),
-		for i=1:length(options_structure.highlight)
-			text(x(options_structure.highlight(i)),y(options_structure.highlight(i)), z(options_structure.highlight(i)),num2str(options_structure.highlight(i)),'backgroundcolor',[1 0 0]);
+	if exist(options,'highlight'),
+		list=getfieldvalue(options,'highlight');
+		for i=1:length(list)
+			text(x(list(i)),y(list(i)), z(list(i)),num2str(list(i)),'backgroundcolor',[1 0 0]);
 		end
 	end
@@ -37,7 +38,8 @@
 		text(x(i),y(i), z(i),num2str(i),'backgroundcolor',[0.8 0.9 0.8]);
 	end
-	if ~isnan(options_structure.highlight),
-		for i=1:length(options_structure.highlight)
-			text(x(options_structure.highlight(i)),y(options_structure.highlight(i)), z(options_structure.highlight(i)),num2str(options_structure.highlight(i)),'backgroundcolor',[1 0 0]);
+	if exist(options,'highlight'),
+		list=getfieldvalue(options,'highlight');
+		for i=1:length(list)
+			text(x(list(i)),y(list(i)), z(list(i)),num2str(list(i)),'backgroundcolor',[1 0 0]);
 		end
 	end
@@ -45,9 +47,5 @@
 
 %apply options
-if isnan(options_structure.title)
-	options_structure.title='Grid numbering';
-end 
-if isnan(options_structure.colorbar)
-	options_structure.colorbar=0;
-end
-applyoptions(md,[],options_structure);
+options=addfielddefault(options,'title','Grid numbering');
+options=addfielddefault(options,'colorbar',0);
+applyoptions(md,[],options);
Index: /issm/trunk/src/m/classes/public/plot/plot_highlightelements.m
===================================================================
--- /issm/trunk/src/m/classes/public/plot/plot_highlightelements.m	(revision 2438)
+++ /issm/trunk/src/m/classes/public/plot/plot_highlightelements.m	(revision 2439)
@@ -1,7 +1,7 @@
-function plot_highlightelements(md,options_structure,width,i);
+function plot_highlightelements(md,options,width,i);
 %PLOT_HIGHLIGHTELEMENTS - plot selected elements
 %
 %   Usage:
-%      plot_highlightelements(md,options_structure,width,i);
+%      plot_highlightelements(md,options,width,i);
 %
 %   See also: PLOTMODEL
@@ -11,6 +11,6 @@
 
 %process data and model
-[x y z elements is2d]=processmesh(md,options_structure);
-[elementnumbers isgrid]=processdata(md,[1:md.numberofelements]',options_structure);
+[x y z elements is2d]=processmesh(md,options);
+[elementnumbers isgrid]=processdata(md,[1:md.numberofelements]',options);
 
 %plot
@@ -20,5 +20,5 @@
 	patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
 	for i=1:size(elements,1),
-		if ~isnan(options_structure.highlight) & ismember(elementnumbers(i),options_structure.highlight)
+		if ismember(elementnumbers(i),getfieldvalue(options,'highlight',[]))
 			A=elements(i,1); B=elements(i,2);  C=elements(i,3);
 			patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', [0.9 0.5 0.5],'FaceColor','flat','EdgeColor','black');
@@ -34,5 +34,5 @@
 	patch( 'Faces', [C A D F ], 'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
 	for i=1:size(elements,1),
-		if ~isnan(options_structure.highlight) & ismember(elementnumbers(i),options_structure.highlight)
+		if ismember(elementnumbers(i),getfieldvalue(options,'highlight',[]))
 			A=elements(i,1); B=elements(i,2);  C=elements(i,3);  D=elements(i,4); E=elements(i,5);  F=elements(i,6);
 			patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', [0.9 0.5 0.5],'FaceColor','flat','EdgeColor','black');
@@ -46,12 +46,8 @@
 
 %apply options
-if isnan(options_structure.highlight)
+if ~exist(options,'highlight')
 	disp('highlightelements warning : highlight option empty, not element highlighted');
 end
-if isnan(options_structure.title)
-	options_structure.title='Highlighted Elements';
-end
-if isnan(options_structure.colorbar)
-	options_structure.colorbar=0;
-end
-applyoptions(md,[],options_structure);
+options=addfielddefault(options,'title','Highlighted Elements');
+options=addfielddefault(options,'colorbar',0);
+applyoptions(md,[],options);
Index: /issm/trunk/src/m/classes/public/plot/plot_highlightgrids.m
===================================================================
--- /issm/trunk/src/m/classes/public/plot/plot_highlightgrids.m	(revision 2438)
+++ /issm/trunk/src/m/classes/public/plot/plot_highlightgrids.m	(revision 2439)
@@ -1,13 +1,13 @@
-function plot_highlightgrids(md,options_structure,width,i);
+function plot_highlightgrids(md,options,width,i);
 %PLOT_HIGHLIGHTGRIDS - plot selected grids
 %
 %   Usage:
-%      plot_highlightgrids(md,options_structure,width,i);
+%      plot_highlightgrids(md,options,width,i);
 %
 %   See also: PLOTMODEL
 
 %process data and model
-[x y z elements is2d]=processmesh(md,options_structure);
-[gridnumbers isongrid isquiver]=processdata(md,[1:md.numberofgrids]',options_structure);
+[x y z elements is2d]=processmesh(md,options);
+[gridnumbers isongrid isquiver]=processdata(md,[1:md.numberofgrids]',options);
 
 %plot
@@ -18,8 +18,8 @@
 	A=elements(:,1); B=elements(:,2); C=elements(:,3);
 	patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
-	if ~isnan(options_structure.highlight),
-		for i=1:length(options_structure.highlight)
-			text(x(options_structure.highlight(i)),y(options_structure.highlight(i)), z(options_structure.highlight(i)),num2str(options_structure.highlight(i)),'backgroundcolor',[1 0 0]);
-		end
+	list=getfieldvalue(options,'highlight',[]);
+	for i=1:length(list)
+		text(x(list(i)),y(list(i)), z(list(i)),num2str(list(i)),'backgroundcolor',[1 0 0]);
+	end
 	end
 else
@@ -31,20 +31,16 @@
 	patch( 'Faces', [B E F C ], 'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
 	patch( 'Faces', [C A D F ], 'Vertices', [x y z],'FaceVertexCData', [1 1 1],'FaceColor','none','EdgeColor','black');
-	if ~isnan(options_structure.highlight),
-		for i=1:length(options_structure.highlight)
-			text(x(options_structure.highlight(i)),y(options_structure.highlight(i)), z(options_structure.highlight(i)),num2str(options_structure.highlight(i)),'backgroundcolor',[1 0 0]);
-		end
+	list=getfieldvalue(options,'highlight',[]);
+	for i=1:length(list)
+		text(x(list(i)),y(list(i)), z(list(i)),num2str(list(i)),'backgroundcolor',[1 0 0]);
+	end
 	end
 end
 
 %apply options
-if isnan(options_structure.highlight)
+if ~exist(options,'highlight')
 	disp('highlightgrids warning : highlight option empty, not grid highlighted');
 end
-if isnan(options_structure.title)
-	options_structure.title='Highlighted Grids';
-end 
-if isnan(options_structure.colorbar)
-	options_structure.colorbar=0;
-end
-applyoptions(md,[],options_structure);
+options=addfielddefault(options,'title','Highlighted Grids');
+options=addfielddefault(options,'colorbar',0);
+applyoptions(md,[],options);
Index: /issm/trunk/src/m/classes/public/plot/plot_importancefactors.m
===================================================================
--- /issm/trunk/src/m/classes/public/plot/plot_importancefactors.m	(revision 2438)
+++ /issm/trunk/src/m/classes/public/plot/plot_importancefactors.m	(revision 2439)
@@ -1,13 +1,13 @@
-function plot_importancefactors(md,options_structure,width,ii);
+function plot_importancefactors(md,options,width,ii);
 %PLOT_IMPORTANCEFACTORS - plot importance factors
 %
 %   Usage:
-%      plot_importancefactors(md,options_structure,width,i);
+%      plot_importancefactors(md,options,width,i);
 %
 %   See also: PLOTMODEL
 
 %first recover design variable descriptor
-if ~isnan(options_structure.designvariable),
-	descriptor=options_structure.designvariable;
+if exist(options,'designvariable'),
+	descriptor=getfieldvalue(options,'designvariable');
 else
 	error('plot_importancefactors error message: Need to supply design variable descriptor');
@@ -16,6 +16,6 @@
 
 %then recover responsfunction name
-if ~isnan(options_structure.responsefunction),
-	responsefunctiondescriptor=options_structure.responsefunction;
+if exist(options,'responsefunction'),
+	responsefunctiondescriptor=getfieldvalue(options,'responsefunction');
 else
 	error('plot_importancefactors error message: Need to supply response function descriptor');
@@ -52,6 +52,6 @@
 
 %log?
-if ~isnan(options_structure.log),
-	logvalue=options_structure.log;
+if exist(options,'log'),
+	logvalue=getfieldvalue(options,'log');
 	importancefactors=log(importancefactors)/log(logvalue);
 end
@@ -64,12 +64,8 @@
 
 %process data and model
-[x y z elements is2d]=processmesh(md,options_structure);
+[x y z elements is2d]=processmesh(md,options);
 
-%edgecolor?
-if ~isnan(options_structure.edgecolor),
-	edgecolor=options_structure.edgecolor;
-else
-	edgecolor='none';
-end
+%edgecolor
+edgecolor=getfieldvalue(options,'edgecolor','none');
 
 %standard plot:
@@ -85,3 +81,3 @@
 
 %apply options
-applyoptions(md,[],options_structure);
+applyoptions(md,[],options);
Index: /issm/trunk/src/m/classes/public/plot/plot_manager.m
===================================================================
--- /issm/trunk/src/m/classes/public/plot/plot_manager.m	(revision 2438)
+++ /issm/trunk/src/m/classes/public/plot/plot_manager.m	(revision 2439)
@@ -1,15 +1,15 @@
-function plot_manager(md,optionstring,width,i);
+function plot_manager(md,options,width,i);
 %PLOT__MANAGER - distribute the plots, called by plotmodel
 %
 %   Usage:
-%      plot_manager(md,optionstring,width,i);
+%      plot_manager(md,options,width,i);
 %
 %   See also: PLOTMODEL, PLOT_UNIT
 
 %parse options and get a structure of options. 
-options_structure=parse_options(md,optionstring);
+options=checkplotoptions(md,options);
 
 %get data to be displayed
-data=findarg(optionstring,'data');data=data.value;
+data=getfieldvalue(options,'data');
 
 %figure out if this is a special plot
@@ -19,73 +19,73 @@
 
 		case 'boundaries',
-			plot_boundaries(md,options_structure,width,i);
+			plot_boundaries(md,options,width,i);
 			return;
 		case 'elementnumbering',
-			plot_elementnumbering(md,options_structure,width,i);
+			plot_elementnumbering(md,options,width,i);
 			return;
 		case 'highlightelements',
-			plot_highlightelements(md,options_structure,width,i);
+			plot_highlightelements(md,options,width,i);
 			return;
 		case 'segmentnumbering',
-			plot_segmentnumbering(md,options_structure,width,i);
+			plot_segmentnumbering(md,options,width,i);
 			return;
 		case 'histnorm',
-			plot_qmuhistnorm(md,options_structure,width,i);
+			plot_qmuhistnorm(md,options,width,i);
 			return;
 		case 'elements_type',
-			plot_elementstype(md,options_structure,width,i);
+			plot_elementstype(md,options,width,i);
 			return;
 		case 'gridnumbering',
-			plot_gridnumbering(md,options_structure,width,i);
+			plot_gridnumbering(md,options,width,i);
 			return;
 		case 'highlightgrids',
-			plot_highlightgrids(md,options_structure,width,i);
+			plot_highlightgrids(md,options,width,i);
 			return;
 		case {'basal_drag','basal_dragx','basal_dragy'},
-			plot_basaldrag(md,options_structure,width,i,data);
+			plot_basaldrag(md,options,width,i,data);
 			return;
 		case 'driving_stress',
-			plot_drivingstress(md,options_structure,width,i);
+			plot_drivingstress(md,options,width,i);
 			return;
 		case 'mesh',
-			plot_mesh(md,options_structure,width,i);
+			plot_mesh(md,options,width,i);
 			return;
 		case 'penalties',
-			plot_penalties(md,options_structure,width,i);
+			plot_penalties(md,options,width,i);
 			return;
 		case 'riftvel',
-			plot_riftvel(md,options_structure,width,i);
+			plot_riftvel(md,options,width,i);
 			return;
 		case 'riftrelvel',
-			plot_riftrelvel(md,options_structure,width,i);
+			plot_riftrelvel(md,options,width,i);
 			return;
 		case 'riftpenetration',
-			plot_riftpenetration(md,options_structure,width,i);
+			plot_riftpenetration(md,options,width,i);
 			return;
 		case 'riftfraction',
-			plot_riftfraction(md,options_structure,width,i);
+			plot_riftfraction(md,options,width,i);
 			return;
 		case 'sarpwr',
-			plot_sarpwr(md,options_structure,width,i)
+			plot_sarpwr(md,options,width,i)
 			return
 		case 'pressureload'
-			plot_pressureload(md,options_structure,width,i,data)
+			plot_pressureload(md,options,width,i,data)
 			return
 		case 'segments'
-			plot_segments(md,options_structure,width,i,data)
+			plot_segments(md,options,width,i,data)
 			return
 		case {'strainrate_tensor','strainrate','strainrate_principal','strainrate_principalaxis1','strainrate_principalaxis2','strainrate_principalaxis3',...
 				'stress_tensor','stress','stress_principal','stress_principalaxis1','stress_principalaxis2','stress_principalaxis3',...
 				'deviatoricstress_tensor','deviatoricstress','deviatoricstress_principal','deviatoricstress_principalaxis1','deviatoricstress_principalaxis2','deviatoricstress_principalaxis3'},
-			plot_tensor(md,options_structure,width,i,data);
+			plot_tensor(md,options,width,i,data);
 			return;
 		case 'thermaltransient_results',
-			plot_thermaltransient_results(md,options_structure,width,i);
+			plot_thermaltransient_results(md,options,width,i);
 			return;
 		case 'transient_movie',
-			plot_transient_movie(md,options_structure,width,i);
+			plot_transient_movie(md,options,width,i);
 			return;
 		case 'transient_results',
-			plot_transient_results(md,options_structure,width,i);
+			plot_transient_results(md,options,width,i);
 			return;
 
@@ -101,32 +101,29 @@
 
 %Figure out if this is a semi-transparent plot.
-if ~isnan(options_structure.overlay),
-	plot_overlay(md,data,options_structure,width,i);
+if exist(options,'overlay'),
+	plot_overlay(md,data,options,width,i);
 	return;
 end
 
 %Figure out if this is a Section plot
-if ~isnan(options_structure.sectionvalue)
-	plot_section(md,data,options_structure,width,i);
+if exist(options,'sectionvalue')
+	plot_section(md,data,options,width,i);
 	return;
 end
 
 %process data and model
-[x y z elements is2d]=processmesh(md,options_structure);
-[data2 isongrid isquiver]=processdata(md,data,options_structure);
+[x y z elements is2d]=processmesh(md,options);
+[data2 isongrid isquiver]=processdata(md,data,options);
 
 %standard plot:
 subplot(width,width,i);
-plot_unit(x,y,z,elements,data2,isongrid,is2d,isquiver,options_structure);
+plot_unit(x,y,z,elements,data2,isongrid,is2d,isquiver,options);
 
 %apply all options
-if isnan(options_structure.shading) & isnan(options_structure.edgecolor) & size(data2,1)==md.numberofgrids,
-	options_structure.shading='interp';
+if isquiver & getfieldvalue(options,'colorbar',0)~=1
+	options.colorbar=2;
 end
-if isquiver & ~strcmpi(options_structure.colorbar,'off'),
-	options_structure.colorbar=2;
-end
-if isquiver & (iscell(options_structure.contourlevels) | ~isnan(options_structure.contourlevels)),
+if isquiver & exist(options,'contourlevels'),
 	data2=data;
 end
-applyoptions(md,data2,options_structure);
+applyoptions(md,data2,options);
Index: /issm/trunk/src/m/classes/public/plot/plot_mesh.m
===================================================================
--- /issm/trunk/src/m/classes/public/plot/plot_mesh.m	(revision 2438)
+++ /issm/trunk/src/m/classes/public/plot/plot_mesh.m	(revision 2439)
@@ -1,12 +1,12 @@
-function plot_mesh(md,options_structure,width,i);
+function plot_mesh(md,options,width,i);
 %PLOT_MESH - plot model mesh
 %
 %   Usage:
-%      plot_mesh(md,options_structure,width,i);
+%      plot_mesh(md,options,width,i);
 %
 %   See also: PLOTMODEL
 
 %process data and model
-[x y z elements is2d]=processmesh(md,options_structure);
+[x y z elements is2d]=processmesh(md,options);
 
 %plot mesh
@@ -27,9 +27,5 @@
 
 %apply options
-if isnan(options_structure.title)
-	options_structure.title='Mesh';
-end 
-if isnan(options_structure.colorbar)
-	options_structure.colorbar=0;
-end
-applyoptions(md,[],options_structure);
+options=addfielddefault(options,'title','Mesh');
+options=addfielddefault(options,'colorbar',0);
+applyoptions(md,[],options);
Index: /issm/trunk/src/m/classes/public/plot/plot_overlay.m
===================================================================
--- /issm/trunk/src/m/classes/public/plot/plot_overlay.m	(revision 2438)
+++ /issm/trunk/src/m/classes/public/plot/plot_overlay.m	(revision 2439)
@@ -1,13 +1,13 @@
-function plot_overlay(md,data,options_structure,width,i)
+function plot_overlay(md,data,options,width,i)
 %PLOT_OVERLAY - superimpose radar image to a given field
 %
 %   Usage:
-%      plot_overlay(md,options_structure,width,i);
+%      plot_overlay(md,options,width,i);
 %
 %   See also: PLOTMODEL
 
 %process mesh and data
-[x y z elements is2d]=processmesh(md,options_structure);
-[data isongrid isquiver]=processdata(md,data,options_structure);
+[x y z elements is2d]=processmesh(md,options);
+[data isongrid isquiver]=processdata(md,data,options);
 
 %check is2d
@@ -17,14 +17,6 @@
 
 %get xlim and ylim
-if ~isnan(options_structure.xlim),
-	xlim=options_structure.xlim;
-else
-	xlim=[min(md.x) max(md.x)];
-end
-if ~isnan(options_structure.ylim),
-	ylim=options_structure.ylim;
-else
-	ylim=[min(md.y) max(md.y)];
-end
+xlim=getfieldvalue(options,'xlim',[min(md.x) max(md.x)]);
+ylim=getfieldvalue(options,'ylim',[min(md.y) max(md.y)]);
 
 %radar power
@@ -36,5 +28,5 @@
 if redo,
 	t1=clock; fprintf('%s','Extracting radar image...');
-	md=radarpower(md,xlim,ylim,options_structure.highres);
+	md=radarpower(md,xlim,ylim,getfieldvalue(options,'highres',0));
 	t2=clock;fprintf('%s\n',[' done (' num2str(etime(t2,t1)) ' seconds)']);
 end
@@ -54,7 +46,8 @@
 if redo,
 	%apply caxis if required
-	if ~isnan(options_structure.caxis),
-		data(find(data<options_structure.caxis(1)))=options_structure.caxis(1);
-		data(find(data>options_structure.caxis(2)))=options_structure.caxis(2);
+	if exist(options,'caxis'),
+		caxis_opt=getfieldvalue(options,'caxis');
+		data(find(data<caxis_opt(1)))=caxis_opt(1);
+		data(find(data>caxis_opt(2)))=caxis_opt(2);
 	end
 
@@ -75,6 +68,6 @@
 
 %Build hsv color image from radar and results
-transparency=options_structure.alpha;
-border=options_structure.border;
+transparency=getfieldvalue(options,'alpha',1.5);  %Rignot's setting: 1.5
+border=getfieldvalue(options,'border',0);
 
 %intensity
@@ -107,18 +100,9 @@
 
 %Apply options, without colorbar and without grid
-if ~isnan(options_structure.fontsize),
-	fontsize=options_structure.fontsize;
-else
-	fontsize=14;
-end
-if isnan(options_structure.axis),
-	options_structure.axis='equal off';
-end
-if isnan(options_structure.colorbarpos),
-	options_structure.colorbarpos=[0.80 0.70 0.02 0.15];
-end
-iscolorbar=(options_structure.colorbar==1 | isnan(options_structure.colorbar));
-options_structure.colorbar=0;
-applyoptions(md,data,options_structure);
+iscolorbar=getfieldvalue(options,'colorbar',1);
+options=changefieldvalue(options,'colorbar',0);
+options=addfielddefault(options,'axis','equal off');
+options=addfielddefault(options,'colorbarpos',[0.80 0.70 0.02 0.15]);
+applyoptions(md,data,options);
 
 %colorbar
@@ -126,9 +110,9 @@
 
 	%create colorbar with correct colors and position
-	colorbar_rgb=buildoverlaycolorbar(md,data,options_structure.alpha);
+	colorbar_rgb=buildoverlaycolorbar(md,data,getfieldvalue(options,'aplha',1.5));
 	colorbar_handle=colorbar; 
 	colorbar_image_handle=get(colorbar_handle,'Children'); 
 	set(colorbar_image_handle,'CData',colorbar_rgb);
-	set(colorbar_handle,'Position',options_structure.colorbarpos);
+	set(colorbar_handle,'Position',getfieldvalue(options,'colorbarpos'));
 
 	%modify ticks.
@@ -147,4 +131,4 @@
 	set(colorbar_handle,'YTickLabel',scalestring);
 	set(colorbar_handle,'YColor','y');
-	set(colorbar_handle,'FontSize',fontsize);
+	set(colorbar_handle,'FontSize',getfieldvalue(options,'fontsize',14));
 end
Index: /issm/trunk/src/m/classes/public/plot/plot_penalties.m
===================================================================
--- /issm/trunk/src/m/classes/public/plot/plot_penalties.m	(revision 2438)
+++ /issm/trunk/src/m/classes/public/plot/plot_penalties.m	(revision 2439)
@@ -1,12 +1,12 @@
-function plot_penalties(md,options_structure,width,i);
+function plot_penalties(md,options,width,i);
 %PLOT_PENALTIES - plot penalties
 %
 %   Usage:
-%      plot_penalties(md,options_structure,width,i);
+%      plot_penalties(md,options,width,i);
 %
 %   See also: PLOTMODEL
 
 %process data and model
-[x y z elements is2d]=processmesh(md,options_structure);
+[x y z elements is2d]=processmesh(md,options);
 
 %plot mesh penalties
@@ -14,8 +14,9 @@
 
 %units
-if ~isnan(options_structure.unitmultiplier),
-	x=x*options_structure.unitmultiplier;
-	y=y*options_structure.unitmultiplier;
-	z=z*options_structure.unitmultiplier;
+if exist(options,'unit'),
+	unit=getfieldvalue(options,'unit');
+	x=x*unit;
+	y=y*unit;
+	z=z*unit;
 end
 
@@ -43,9 +44,5 @@
 
 %apply options
-if isnan(options_structure.title)
-	options_structure.title='Penalties';
-end 
-if isnan(options_structure.colorbar)
-	options_structure.colorbar=0;
-end
-applyoptions(md,[],options_structure);
+options=addfielddefault(options,'title','Penalties');
+options=addfielddefault(options,'colorbar',0);
+applyoptions(md,[],options);
Index: /issm/trunk/src/m/classes/public/plot/plot_pressureload.m
===================================================================
--- /issm/trunk/src/m/classes/public/plot/plot_pressureload.m	(revision 2438)
+++ /issm/trunk/src/m/classes/public/plot/plot_pressureload.m	(revision 2439)
@@ -1,7 +1,7 @@
-function plot_pressureload(md,options_structure,width,i,data);
+function plot_pressureload(md,options,width,i,data);
 %PLOT_PRESSURELOAD - plot segment on neumann BC
 %
 %   Usage:
-%      plot_pressureload(md,options_structure,width,i);
+%      plot_pressureload(md,options,width,i);
 %
 %   See also: PLOTMODEL
@@ -11,5 +11,5 @@
 
 %process mesh and data
-[x y z elements is2d]=processmesh(md,options_structure);
+[x y z elements is2d]=processmesh(md,options);
 pressureload=md.pressureload;
 
@@ -75,9 +75,5 @@
 
 %apply options
-if isnan(options_structure.title)
-	options_structure.title='Neumann boundary conditions';
-end 
-if isnan(options_structure.colorbar)
-	options_structure.colorbar=0;
-end
-applyoptions(md,[],options_structure);
+options=addfielddefault(options,'title','Neumann boundary conditions');
+options=addfielddefault(options,'colorbar',0);
+applyoptions(md,[],options);
Index: /issm/trunk/src/m/classes/public/plot/plot_qmuhistnorm.m
===================================================================
--- /issm/trunk/src/m/classes/public/plot/plot_qmuhistnorm.m	(revision 2438)
+++ /issm/trunk/src/m/classes/public/plot/plot_qmuhistnorm.m	(revision 2439)
@@ -57,19 +57,15 @@
 
 
-function plot_qmuhistnorm(md,options_structure,width,i);
+function plot_qmuhistnorm(md,options,width,i);
 
 %recover histnorm data
-if isnans(options_structure.histnorm_data)
+if ~exist(options,'histnorm_data')
 	error('plot_qmuhistnorm error message: option histnorm_data is required');
 else
-	varargin=options_structure.histnorm_data;
+	varargin=getfieldvalue(options,'histnorm_data');
 end
 
 %recover fontsize
-if isnans(options_structure.fontsize),
-	fontsize=options_structure.fontsize;
-else
-	fontsize=18;
-end
+fontsize=getfieldvalue(options,'fontsize',18),
 
 nargin=length(varargin);
@@ -267,14 +263,6 @@
 
 %apply options.
-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 isnan(options_structure.colorbar)
-	options_structure.colorbar=0;
-end
-
-applyoptions(md,[],options_structure);
+options=addfielddefault(options,'title','Relative Frequency Histogram');
+options=addfielddefault(options,'xlabel','Interval Edge Value');
+options=addfielddefault(options,'colorbar',0);
+applyoptions(md,[],options);
Index: /issm/trunk/src/m/classes/public/plot/plot_quiver.m
===================================================================
--- /issm/trunk/src/m/classes/public/plot/plot_quiver.m	(revision 2438)
+++ /issm/trunk/src/m/classes/public/plot/plot_quiver.m	(revision 2439)
@@ -1,3 +1,3 @@
-function plot_quiver(x,y,u,v,options_structure),
+function plot_quiver(x,y,u,v,options),
 %PLOT_QUIVER - quiver plot with colors
 %
@@ -5,8 +5,8 @@
 %
 %   Usage:
-%      plot_quiver(x,y,u,v,options_structure)
+%      plot_quiver(x,y,u,v,options)
 %
 %   Example:
-%      plot_quiver(md.x,md.y,md.vx,md.vy,options_structure);
+%      plot_quiver(md.x,md.y,md.vx,md.vy,options);
 
 %keep only non NaN elements
@@ -21,25 +21,20 @@
 
 %process options: scaling factor?
-if isnan(options_structure.scaling),
-	scalingfactor=0.40;
-elseif isnumeric(options_structure.scaling),
-	scalingfactor=options_structure.scaling;
-else
-	error('plot_quiver error message: scaling option other than scalaer or ''off'' not supported yet')
-end
+scalingfactor=getfieldvalue(options,'scaling',0.40);
 
 %number of colors?
-if isnumeric(options_structure.colorlevels),
-	if isnan(options_structure.colorlevels),
+colorlevels=getfieldvalue(options,'colorlevels');
+if isnumeric(colorlevels),
+	if isnan(colorlevels),
 		numcolors=30;
 	else
-		numcolors=options_structure.colorlevels;
+		numcolors=colorlevels;
 	end
 	levels=round_ice(linspace(Min,Max,numcolors+1),2);
 else
-	levels=zeros(1,length(options_structure.colorlevels)+2);
+	levels=zeros(1,length(colorlevels)+2);
 	levels(1)=Min;
-	for i=1:length(options_structure.colorlevels)
-		levels(i+1)=options_structure.colorlevels{i};
+	for i=1:length(colorlevels)
+		levels(i+1)=colorlevels{i};
 	end
 	levels(end)=Max;
@@ -61,5 +56,5 @@
 
 %Scale data
-if ~isnan(options_structure.autoscale) & strcmpi(options_structure.autoscale,'off'),
+if strcmpi(getfieldvalue(options,'autoscale','on'),'off'),
 	delta=((min(x)-max(x))^2+(min(y)-max(y))^2)/numel(x);
 	u=scalingfactor*sqrt(delta)*u./Norm;
@@ -81,5 +76,5 @@
 
 %take care of colorbar
-if  ~strcmpi(options_structure.colorbar,'off'),
+if  ~strcmpi(getfieldvalue(options,'colorbar','on'),'off'),
 
 	%build ticks
@@ -101,13 +96,9 @@
 	set(hcb,'YTickLabel',ticklabel,'YTick',tickpos);
 	%position
-	if ~isnan(options_structure.colorbarpos),
-		set(hcb,'Position',options_structure.colorbarpos);
+	if exist(options.colorbarpos),
+		set(hcb,'Position',getfieldvalue(options,'colorbarpos'));
 	end
 	%fontsize
-	if ~isnan(options_structure.fontsize),
-		fontsize=options_structure.fontsize;
-	else
-		fontsize=14;
-	end
+	fontsize=getfieldvalue(options,'fontsize',14);
 	set(hcb,'FontSize',fontsize);
 end
Index: /issm/trunk/src/m/classes/public/plot/plot_quiver3.m
===================================================================
--- /issm/trunk/src/m/classes/public/plot/plot_quiver3.m	(revision 2438)
+++ /issm/trunk/src/m/classes/public/plot/plot_quiver3.m	(revision 2439)
@@ -1,3 +1,3 @@
-function plot_quiver3(x,y,z,u,v,w,options_structure),
+function plot_quiver3(x,y,z,u,v,w,options),
 %PLOT_QUIVER3 - 3d quiver plot with colors
 %
@@ -5,8 +5,8 @@
 %
 %   Usage:
-%      plot_quiver3(x,y,z,u,v,w,options_structure)
+%      plot_quiver3(x,y,z,u,v,w,options)
 %
 %   Example:
-%      plot_quiver(md.x,md.y,md.z,md.vx,md.vy,md.vz,options_structure);
+%      plot_quiver(md.x,md.y,md.z,md.vx,md.vy,md.vz,options);
 
 %keep only non NaN elements
@@ -21,25 +21,20 @@
 
 %process options: scaling factor?
-if isnan(options_structure.scaling),
-	scalingfactor=0.40;
-elseif isnumeric(options_structure.scaling),
-	scalingfactor=options_structure.scaling;
-else
-	error('plot_quiver error message: scaling option other than scalaer or ''off'' not supported yet')
-end
+scalingfactor=getfieldvalue(options,'scaling',0.40);
 
 %number of colors?
-if isnumeric(options_structure.colorlevels),
-	if isnan(options_structure.colorlevels),
+colorlevels=getfieldvalue(options,'colorlevels',NaN);
+if isnumeric(colorlevels),
+	if isnan(colorlevels),
 		numcolors=30;
 	else
-		numcolors=options_structure.colorlevels;
+		numcolors=colorlevels;
 	end
 	levels=round_ice(linspace(Min,Max,numcolors+1),2);
 else
-	levels=zeros(1,length(options_structure.colorlevels)+2);
+	levels=zeros(1,length(colorlevels)+2);
 	levels(1)=Min;
-	for i=1:length(options_structure.colorlevels)
-		levels(i+1)=options_structure.colorlevels{i};
+	for i=1:length(colorlevels)
+		levels(i+1)=colorlevels{i};
 	end
 	levels(end)=Max;
@@ -61,5 +56,5 @@
 
 %Scale data
-if ~isnan(options_structure.autoscale) & strcmpi(options_structure.autoscale,'off'),
+if strcmpi(getfieldvalue(options,'autoscale','on'),'off'),
 	delta=((min(x)-max(x))^2+(min(y)-max(y))^2)/numel(x);
 	u=scalingfactor*sqrt(delta)*u./Norm;
@@ -81,5 +76,5 @@
 
 %take care of colorbar
-if  ~strcmpi(options_structure.colorbar,'off'),
+if  ~strcmpi(getfieldvalue(options,'colorbar','on'),'off'),
 
 	%build ticks
@@ -101,13 +96,9 @@
 	set(hcb,'YTickLabel',ticklabel,'YTick',tickpos);
 	%position
-	if ~isnan(options_structure.colorbarpos),
-		set(hcb,'Position',options_structure.colorbarpos);
+	if exist(options,'colorbarpos'),
+		set(hcb,'Position',getfieldvalue(options,'colorbarpos'));
 	end
 	%fontsize
-	if ~isnan(options_structure.fontsize),
-		fontsize=options_structure.fontsize;
-	else
-		fontsize=14;
-	end
+	fontsize=getfieldvalue(options,'fontsize',14);
 	set(hcb,'FontSize',fontsize);
 end
Index: /issm/trunk/src/m/classes/public/plot/plot_riftfraction.m
===================================================================
--- /issm/trunk/src/m/classes/public/plot/plot_riftfraction.m	(revision 2438)
+++ /issm/trunk/src/m/classes/public/plot/plot_riftfraction.m	(revision 2439)
@@ -1,7 +1,7 @@
-function plot_riftfraction(md,options_structure,width,i);
+function plot_riftfraction(md,options,width,i);
 %PLOT_RIFTRELVEL - plot rift fractions
 %
 %   Usage:
-%      plot_riftfraction(md,options_structure,width,i);
+%      plot_riftfraction(md,options,width,i);
 %
 %   See also: PLOTMODEL
@@ -11,8 +11,9 @@
 
 %units
-if ~isnan(options_structure.unitmultiplier),
-	md.x=md.x*options_structure.unitmultiplier;
-	md.y=md.y*options_structure.unitmultiplier;
-	md.z=md.z*options_structure.unitmultiplier;
+if exist(options,'unit'),
+	unit=getfieldvalue(options,'unit');
+	md.x=md.x*unit;
+	md.y=md.y*unit;
+	md.z=md.z*unit;
 end
 
@@ -45,9 +46,5 @@
 
 %apply options
-if isnan(options_structure.title)
-	options_structure.title='Rift relative velocities';
-end 
-if isnan(options_structure.colorbar)
-	options_structure.colorbar=0;
-end
-applyoptions(md,[],options_structure);
+options=addfielddefault(options,'title','Rift relative velocities');
+options=addfielddefault(options,'colorbar',0);
+applyoptions(md,[],options);
Index: /issm/trunk/src/m/classes/public/plot/plot_riftpenetration.m
===================================================================
--- /issm/trunk/src/m/classes/public/plot/plot_riftpenetration.m	(revision 2438)
+++ /issm/trunk/src/m/classes/public/plot/plot_riftpenetration.m	(revision 2439)
@@ -1,7 +1,7 @@
-function plot_rifpenetration(md,options_structure,width,i);
+function plot_rifpenetration(md,options,width,i);
 %PLOT_RIFTPENETRATION - plot rift penetration
 %
 %   Usage:
-%      plot_rifpenetration(md,options_structure,width,i);
+%      plot_rifpenetration(md,options,width,i);
 %
 %   See also: PLOTMODEL
@@ -11,8 +11,9 @@
 
 %units
-if ~isnan(options_structure.unitmultiplier),
-	md.x=md.x*options_structure.unitmultiplier;
-	md.y=md.y*options_structure.unitmultiplier;
-	md.z=md.z*options_structure.unitmultiplier;
+if exist(options,'unit'),
+	unit=getfieldvalue(options,'unit');
+	md.x=md.x*unit;
+	md.y=md.y*unit;
+	md.z=md.z*unit;
 end
 
@@ -77,9 +78,5 @@
 
 %apply options
-if isnan(options_structure.title)
-	options_structure.title='Rift Penetration';
-end 
-if isnan(options_structure.colorbar)
-	options_structure.colorbar=0;
-end
-applyoptions(md,[],options_structure);
+options=addfielddefault(options,'title','Rift Penetration');
+options=addfielddefault(options,'colorbar',0);
+applyoptions(md,[],options);
Index: /issm/trunk/src/m/classes/public/plot/plot_riftrelvel.m
===================================================================
--- /issm/trunk/src/m/classes/public/plot/plot_riftrelvel.m	(revision 2438)
+++ /issm/trunk/src/m/classes/public/plot/plot_riftrelvel.m	(revision 2439)
@@ -1,7 +1,7 @@
-function plot_riftrelvel(md,options_structure,width,i);
+function plot_riftrelvel(md,options,width,i);
 %PLOT_RIFTRELVEL - plot rift relative velocities
 %
 %   Usage:
-%      plot_riftrelvel(md,options_structure,width,i);
+%      plot_riftrelvel(md,options,width,i);
 %
 %   See also: PLOTMODEL
@@ -11,8 +11,9 @@
 
 %units
-if ~isnan(options_structure.unitmultiplier),
-	md.x=md.x*options_structure.unitmultiplier;
-	md.y=md.y*options_structure.unitmultiplier;
-	md.z=md.z*options_structure.unitmultiplier;
+if exist(options,'unit'),
+	unit=getfieldvalue(options,'unit');
+	md.x=md.x*unit;
+	md.y=md.y*unit;
+	md.z=md.z*unit;
 end
 
@@ -79,9 +80,5 @@
 
 %apply options
-if isnan(options_structure.title)
-	options_structure.title='Rift relative velocities';
-end 
-if isnan(options_structure.colorbar)
-	options_structure.colorbar=0;
-end
-applyoptions(md,[],options_structure);
+options=addfielddefault(options,'title','Rift relative velocities');
+options=addfielddefault(options,'colorbar',0);
+applyoptions(md,[],options);
Index: /issm/trunk/src/m/classes/public/plot/plot_riftvel.m
===================================================================
--- /issm/trunk/src/m/classes/public/plot/plot_riftvel.m	(revision 2438)
+++ /issm/trunk/src/m/classes/public/plot/plot_riftvel.m	(revision 2439)
@@ -11,8 +11,9 @@
 
 %units
-if ~isnan(options_structure.unitmultiplier),
-	md.x=md.x*options_structure.unitmultiplier;
-	md.y=md.y*options_structure.unitmultiplier;
-	md.z=md.z*options_structure.unitmultiplier;
+if exist(options,'unit'),
+	unit=getfieldvalue(options,'unit');
+	md.x=md.x*unit;
+	md.y=md.y*unit;
+	md.z=md.z*unit;
 end
 
@@ -78,9 +79,5 @@
 
 %apply options
-if isnan(options_structure.title)
-	options_structure.title='Rift Velocities';
-end 
-if isnan(options_structure.colorbar)
-	options_structure.colorbar=0;
-end
+options=addfielddefault(options_structure,'title','Rift Velocities');
+options=addfielddefault(options_structure,'colorbar',0);
 applyoptions(md,[],options_structure);
Index: /issm/trunk/src/m/classes/public/plot/plot_sarpwr.m
===================================================================
--- /issm/trunk/src/m/classes/public/plot/plot_sarpwr.m	(revision 2438)
+++ /issm/trunk/src/m/classes/public/plot/plot_sarpwr.m	(revision 2439)
@@ -1,7 +1,7 @@
-function plot_sarpwr(md,options_structure,width,i);
+function plot_sarpwr(md,options,width,i);
 %PLOT_SARPWR - plot radar image
 %
 %   Usage:
-%      plot_sarpwr(md,options_structure,width,i);
+%      plot_sarpwr(md,options,width,i);
 %
 %   See also: PLOTMODEL
@@ -11,8 +11,9 @@
 
 %units
-if ~isnan(options_structure.unitmultiplier),
-	md.x=md.x*options_structure.unitmultiplier;
-	md.y=md.y*options_structure.unitmultiplier;
-	md.z=md.z*options_structure.unitmultiplier;
+if exist(options,'unit'),
+	unit=getfieldvalue(options,'unit');
+	md.x=md.x*unit;
+	md.y=md.y*unit;
+	md.z=md.z*unit;
 end
 					
@@ -20,8 +21,6 @@
 
 %apply options
-if isnan(options_structure.colorbar)
-	options_structure.colorbar=0;
-end
-options_structure.colormap='gray';
+options=addfielddefault(options,'colorbar',0);
+options=changefieldvalue(options,'colormap','gray');
 
-applyoptions(md,[],options_structure);
+applyoptions(md,[],options);
Index: /issm/trunk/src/m/classes/public/plot/plot_section.m
===================================================================
--- /issm/trunk/src/m/classes/public/plot/plot_section.m	(revision 2438)
+++ /issm/trunk/src/m/classes/public/plot/plot_section.m	(revision 2439)
@@ -1,12 +1,12 @@
-function plot_section(md,data,options_structure,width,i)
+function plot_section(md,data,options,width,i)
 %PLOT_SECTION - plot a given field on a section
 %
 %   Usage:
-%      plot_section(md,options_structure,width,i);
+%      plot_section(md,options,width,i);
 %
 %   See also: PLOTMODEL
 
 %How many subplots?
-if ~isnan(options_structure.showsection)
+if exist(options,'showsection')
 
 	%Compute the indexes of the 2 plots (one for the sectionvalue and one for showsection
@@ -21,15 +21,15 @@
 
 %process data and model
-[x_m y_m z_m elements_m is2d]=processmesh(md,options_structure);
-[data isongrid isquiver]=processdata(md,data,options_structure);
+[x_m y_m z_m elements_m is2d]=processmesh(md,options);
+[data isongrid isquiver]=processdata(md,data,options);
 
 %replug x and y onto model so that SectionValue treats the problem correctly
-if ~isnan(options_structure.layer)
+if exist(options,'layer')
 	md.x=md.x2d; md.y=md.y2d; md.elements=md.elements2d; md.type='2d';
 end
 
 %resolution
-if ~isnan(options_structure.resolution),
-	resolution=options_structure.resolution;
+if exist(options,'resolution'),
+	resolution=getfieldvalue(options,'resolution');
 else %Default resolution
 	resolution=[1000 10*md.numlayers];
@@ -38,13 +38,13 @@
 
 %Compute section value
-[elements,x,y,z,s,data_s]=SectionValues(md,data,options_structure.sectionvalue,resolution);
+[elements,x,y,z,s,data_s]=SectionValues(md,data,getfieldvalue(options,'sectionvalue'),resolution);
 
 if is2d
 
 	%Show Section if requested by user
-	if ~isnan(options_structure.showsection)
+	if exist(options,'showsection')
 
 		%compute number of labels
-		numlabels=min(options_structure.showsection,length(s));
+		numlabels=min(getfieldvalue(options,'showsection'),length(s));
 		shift=fix(length(s)/numlabels);
 
@@ -59,5 +59,5 @@
 		%plot section only with labels
 		subplot(width,width,index2)
-		plot_unit(x_m,y_m,z_m,elements_m,data,isongrid,is2d,isquiver,options_structure)
+		plot_unit(x_m,y_m,z_m,elements_m,data,isongrid,is2d,isquiver,options)
 		hold on
 		text(x(1),y(1),'1','backgroundcolor',[0.8 0.9 0.8])
@@ -78,11 +78,11 @@
 	%plot section value
 	%if user requested view2: 2d plot with curvilinear coordinate
-	if (~isnan(options_structure.view) & options_structure.view==2 )
+	if (getfieldvalue(options,'view',3)==2 )
 
 		%Show Section if requested by user
-		if ~isnan(options_structure.showsection)
+		if ~exist(options,'showsection')
 
 			%compute number of labels
-			numlabels=min(options_structure.showsection,length(s));
+			numlabels=min(getfieldvalue(options,'showsection'),length(s));
 			shift=fix(length(s)/numlabels);
 
@@ -97,5 +97,5 @@
 			%plot section only with labels
 			subplot(width,width,index2)
-			plot_unit(x_m,y_m,z_m,elements_m,data,isongrid,is2d,isquiver,options_structure)
+			plot_unit(x_m,y_m,z_m,elements_m,data,isongrid,is2d,isquiver,options)
 			hold on
 			text(x(1),y(1),'1','backgroundcolor',[0.8 0.9 0.8])
@@ -116,8 +116,8 @@
 
 		%Show Section if requested by user
-		if ~isnan(options_structure.showsection)
+		if exist(options,'showsection')
 
 			%compute number of labels
-			numlabels=min(options_structure.showsection,length(s));
+			numlabels=min(getfieldvalue(options,'showsection'),length(s));
 			shift=fix(length(x)/numlabels);
 
@@ -132,5 +132,5 @@
 			%plot section only with labels
 			subplot(width,width,index2)
-			plot_unit(x_m,y_m,z_m,elements_m,data,isongrid,is2d,isquiver,options_structure)
+			plot_unit(x_m,y_m,z_m,elements_m,data,isongrid,is2d,isquiver,options)
 			hold on
 			text(x(1),y(1),'1','backgroundcolor',[0.8 0.9 0.8])
@@ -153,15 +153,15 @@
 
 %apply options
-if isnan(options_structure.title)
-	options_structure.title='Section value';
+if isnan(options.title)
+	options=addfielddefault(options,'title','Section value');
 end 
-if isnan(options_structure.colorbar) & strcmpi(md.type,'2d')
-	options_structure.colorbar=0;
+if strcmpi(md.type,'2d')
+	options=addfielddefault(options,'colorbar',0);
 end
-if isnan(options_structure.xlabel) & (strcmpi(md.type,'2d') | options_structure.view==2 )
-	options_structure.xlabel='Curvilinear coordinate';
+if (strcmpi(md.type,'2d') | getfieldvalue(options,'view')==2 )
+	options=addfielddefault(options,'xlabel','Curvilinear coordinate';
 end
-if isnan(options_structure.ylabel) & (strcmpi(md.type,'3d') & options_structure.view==2 )
-	options_structure.ylabel='z';
+if (strcmpi(md.type,'3d') & getfieldvalue(options,'view')==2 )
+	options=addfielddefault(options,'ylabel','z';
 end
-applyoptions(md,[],options_structure);
+applyoptions(md,[],options);
Index: /issm/trunk/src/m/classes/public/plot/plot_segmentnumbering.m
===================================================================
--- /issm/trunk/src/m/classes/public/plot/plot_segmentnumbering.m	(revision 2438)
+++ /issm/trunk/src/m/classes/public/plot/plot_segmentnumbering.m	(revision 2439)
@@ -1,7 +1,7 @@
-function plot_segmentnumbering(md,options_structure,width,i);
+function plot_segmentnumbering(md,options,width,i);
 %PLOT_SEGMENTNUMBERING - plot segment numbering
 %
 %   Usage:
-%      plot_segmentnumbering(md,options_structure,width,i);
+%      plot_segmentnumbering(md,options,width,i);
 %
 %   See also: PLOTMODEL
@@ -11,5 +11,5 @@
 
 %process data and model
-[x y z segments is2d]=processmesh(md,options_structure);
+[x y z segments is2d]=processmesh(md,options);
 
 error('not implemented yet');
@@ -21,5 +21,5 @@
 	for i=1:size(segments,1),
 		text(sum(x(segments(i,:)))/3,sum(y(segments(i,:)))/3,sum(z(segments(i,:)))/3,num2str(segmentnumbers(i)));
-		if ~isnan(options_structure.highlight) & ismember(segmentnumbers(i),options_structure.highlight)
+		if ismember(segmentnumbers(i),getfieldvalue(options,'highlight',[]))
 			A=segments(i,1); B=segments(i,2);  C=segments(i,3);
 			patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', [0.9 0.5 0.5],'FaceColor','flat','EdgeColor','black');
@@ -36,5 +36,5 @@
 	for i=1:size(segments,1),
 		text(sum(x(segments(i,:)))/6,sum(y(segments(i,:)))/6,sum(z(segments(i,:)))/6,num2str(segmentnumbers(i)));
-		if ~isnan(options_structure.highlight) & ismember(segmentnumbers(i),options_structure.highlight)
+		if ismember(segmentnumbers(i),getfieldvalue(options,'highlight',[]))
 			A=segments(i,1); B=segments(i,2);  C=segments(i,3);  D=segments(i,4); E=segments(i,5);  F=segments(i,6);
 			patch( 'Faces', [A B C], 'Vertices', [x y z],'FaceVertexCData', [0.9 0.5 0.5],'FaceColor','flat','EdgeColor','black');
@@ -48,9 +48,5 @@
 
 %apply options
-if isnan(options_structure.title)
-	options_structure.title='Element numbering';
-end
-if isnan(options_structure.colorbar)
-	options_structure.colorbar=0;
-end
-applyoptions(options_structure);
+options=addfielddefault(options,'title','Element numbering');
+options=addfielddefault(options,'colorbar',0);
+applyoptions(options);
Index: /issm/trunk/src/m/classes/public/plot/plot_segments.m
===================================================================
--- /issm/trunk/src/m/classes/public/plot/plot_segments.m	(revision 2438)
+++ /issm/trunk/src/m/classes/public/plot/plot_segments.m	(revision 2439)
@@ -1,7 +1,7 @@
-function plot_segments(md,options_structure,width,i,datai);
+function plot_segments(md,options,width,i,datai);
 %PLOT_SEGMENTS - plot segments, with different colors according to segment markers.
 %
 %   Usage:
-%      plot_segments(md,options_structure,width,i);
+%      plot_segments(md,options,width,i);
 %
 %   See also: PLOTMODEL
@@ -11,8 +11,9 @@
 
 %units
-if ~isnan(options_structure.unitmultiplier),
-	md.x=md.x*options_structure.unitmultiplier;
-	md.y=md.y*options_structure.unitmultiplier;
-	md.z=md.z*options_structure.unitmultiplier;
+if exist(options,'unit'),
+	unit=getfieldvalue(options,'unit');
+	md.x=md.x*unit;
+	md.y=md.y*unit;
+	md.z=md.z*unit;
 end
 
@@ -44,9 +45,5 @@
 
 %apply options
-if isnan(options_structure.title)
-	options_structure.title='Segment boundaries';
-end 
-if isnan(options_structure.colorbar)
-	options_structure.colorbar=0;
-end
-applyoptions(md,[],options_structure);
+options=addfielddefault(options,'title','Segment boundaries');
+options=addfielddefault(options,'colorbar',0);
+applyoptions(md,[],options);
Index: /issm/trunk/src/m/classes/public/plot/plot_streamlines.m
===================================================================
--- /issm/trunk/src/m/classes/public/plot/plot_streamlines.m	(revision 2438)
+++ /issm/trunk/src/m/classes/public/plot/plot_streamlines.m	(revision 2439)
@@ -1,7 +1,7 @@
-function plot_streamlines(md,options_structure)
+function plot_streamlines(md,options)
 %PLOT_STREAMLINES - plot stream lines on a figure
 %
 %   Usage:
-%      plot_streamlines(md,options_structure)
+%      plot_streamlines(md,options)
 
 %some options
@@ -10,7 +10,7 @@
 
 %process data and model
-[x y z index is2d]=processmesh(md,options_structure);
-[u isongrid isquiver]=processdata(md,md.vx,options_structure);
-[v isongrid isquiver]=processdata(md,md.vy,options_structure);
+[x y z index is2d]=processmesh(md,options);
+[u isongrid isquiver]=processdata(md,md.vx,options);
+[v isongrid isquiver]=processdata(md,md.vy,options);
 
 %some checks
@@ -25,13 +25,14 @@
 
 %initialize flowpath
-if iscell(options_structure.streamlines)
+streamlines=getfieldvalue(options,'streamlines');
+if iscell(streamlines)
 	x0=[]; y0=[];
-	for i=1:size(options_structure.streamlines,2)
-		coord=options_structure.streamlines{i};
+	for i=1:size(streamlines,2)
+		coord=streamlines{i};
 		x0=[x0;coord(1)]; y0=[y0;coord(2)];
 	end
 else
-	x0=x(1:ceil(length(x)/options_structure.streamlines):end);
-	y0=y(1:ceil(length(x)/options_structure.streamlines):end);
+	x0=x(1:ceil(length(x)/streamlines):end);
+	y0=y(1:ceil(length(x)/streamlines):end);
 end
 
Index: /issm/trunk/src/m/classes/public/plot/plot_tensor.m
===================================================================
--- /issm/trunk/src/m/classes/public/plot/plot_tensor.m	(revision 2438)
+++ /issm/trunk/src/m/classes/public/plot/plot_tensor.m	(revision 2439)
@@ -1,7 +1,7 @@
-function plot_tensor(md,options_structure,width,i,type);
+function plot_tensor(md,options,width,i,type);
 %PLOT_TENSOR - plot tensor components
 %
 %   Usage:
-%      plot_tensor(md,options_structure,width,i);
+%      plot_tensor(md,options,width,i);
 %
 %   See also: PLOTMODEL
@@ -27,11 +27,11 @@
 %Figure out type of plot being requested
 if strncmpi(fliplr(type),fliplr('tensor'),6) | strcmpi(type,'strainrate') | strcmpi(type,'deviatoricstress') | strcmpi(type,'stress'),
-	plot_tensor_components(md,options_structure,width,i,tensor,type,plot_options);
+	plot_tensor_components(md,options,width,i,tensor,type,plot_options);
 	return;
 elseif strncmpi(fliplr(type),fliplr('principal'),9),
-	plot_tensor_principal(md,options_structure,width,i,tensor,type,plot_options);
+	plot_tensor_principal(md,options,width,i,tensor,type,plot_options);
 	return;
 elseif strncmpi(fliplr(type(1:end-1)),fliplr('principalaxis'),13),
-	plot_tensor_principalaxis(md,options_structure,width,i,tensor,type,plot_options);
+	plot_tensor_principalaxis(md,options,width,i,tensor,type,plot_options);
 	return;
 else
Index: /issm/trunk/src/m/classes/public/plot/plot_tensor_components.m
===================================================================
--- /issm/trunk/src/m/classes/public/plot/plot_tensor_components.m	(revision 2438)
+++ /issm/trunk/src/m/classes/public/plot/plot_tensor_components.m	(revision 2439)
@@ -1,7 +1,7 @@
-function plot_tensor_components(md,options_structure,width,i,tensor,type,plot_options);
+function plot_tensor_components(md,options,width,i,tensor,type,plot_options);
 %PLOT_TENSOR_COMPONENT - plot component of a tensor
 %
 %   Usage:
-%      plot_tensor_components(md,options_structure,width,i,tensor,type,plot_option);
+%      plot_tensor_components(md,options,width,i,tensor,type,plot_option);
 %
 %   See also: PLOTMODEL, PLOT_UNIT, PLOT_MANAGER
@@ -24,57 +24,55 @@
 
 %process data and model
-[x y z elements is2d]=processmesh(md,options_structure);
-[tensor.xx isongrid isquiver]=processdata(md,tensor.xx,options_structure);
-[tensor.yy isongrid isquiver]=processdata(md,tensor.yy,options_structure);
-[tensor.xy isongrid isquiver]=processdata(md,tensor.xy,options_structure);
+[x y z elements is2d]=processmesh(md,options);
+[tensor.xx isongrid isquiver]=processdata(md,tensor.xx,options);
+[tensor.yy isongrid isquiver]=processdata(md,tensor.yy,options);
+[tensor.xy isongrid isquiver]=processdata(md,tensor.xy,options);
 if  strcmpi(md.type,'3d')
-	[tensor.xz isongrid isquiver]=processdata(md,tensor.xz,options_structure);
-	[tensor.yz isongrid isquiver]=processdata(md,tensor.yz,options_structure);
-	[tensor.zz isongrid isquiver]=processdata(md,tensor.zz,options_structure);
+	[tensor.xz isongrid isquiver]=processdata(md,tensor.xz,options);
+	[tensor.yz isongrid isquiver]=processdata(md,tensor.yz,options);
+	[tensor.zz isongrid isquiver]=processdata(md,tensor.zz,options);
 end
 
 if (strcmpi(md.type,'2d')),
 	subplot(2*width,2*width,index1),
-	plot_unit(x,y,z,elements,tensor.xx,isongrid,is2d,isquiver,options_structure)
-	Apply_options_tensor(md,options_structure,type,'xx')
+	plot_unit(x,y,z,elements,tensor.xx,isongrid,is2d,isquiver,options)
+	Apply_options_tensor(md,options,type,'xx')
 	subplot(2*width,2*width,index2),
-	plot_unit(x,y,z,elements,tensor.yy,isongrid,is2d,isquiver,options_structure)
-	Apply_options_tensor(md,options_structure,type,'yy')
+	plot_unit(x,y,z,elements,tensor.yy,isongrid,is2d,isquiver,options)
+	Apply_options_tensor(md,options,type,'yy')
 	subplot(2*width,2*width,index3),
-	plot_unit(x,y,z,elements,tensor.xy,isongrid,is2d,isquiver,options_structure)
-	Apply_options_tensor(md,options_structure,type,'xy')
+	plot_unit(x,y,z,elements,tensor.xy,isongrid,is2d,isquiver,options)
+	Apply_options_tensor(md,options,type,'xy')
 else
 	subplot(3*width,3*width,index1),
-	plot_unit(x,y,z,elements,tensor.xx,isongrid,is2d,isquiver,options_structure)
-	Apply_options_tensor(md,options_structure,type,'xx')
+	plot_unit(x,y,z,elements,tensor.xx,isongrid,is2d,isquiver,options)
+	Apply_options_tensor(md,options,type,'xx')
 	subplot(3*width,3*width,index2),
-	plot_unit(x,y,z,elements,tensor.yy,isongrid,is2d,isquiver,options_structure)
-	Apply_options_tensor(md,options_structure,type,'yy')
+	plot_unit(x,y,z,elements,tensor.yy,isongrid,is2d,isquiver,options)
+	Apply_options_tensor(md,options,type,'yy')
 	subplot(3*width,3*width,index3),
-	plot_unit(x,y,z,elements,tensor.zz,isongrid,is2d,isquiver,options_structure)
-	Apply_options_tensor(md,options_structure,type,'zz')
+	plot_unit(x,y,z,elements,tensor.zz,isongrid,is2d,isquiver,options)
+	Apply_options_tensor(md,options,type,'zz')
 	subplot(3*width,3*width,index4),
-	plot_unit(x,y,z,elements,tensor.xy,isongrid,is2d,isquiver,options_structure)
-	Apply_options_tensor(md,options_structure,type,'xy')
+	plot_unit(x,y,z,elements,tensor.xy,isongrid,is2d,isquiver,options)
+	Apply_options_tensor(md,options,type,'xy')
 	subplot(3*width,3*width,index5),
-	plot_unit(x,y,z,elements,tensor.xz,isongrid,is2d,isquiver,options_structure)
-	Apply_options_tensor(md,options_structure,type,'xz')
+	plot_unit(x,y,z,elements,tensor.xz,isongrid,is2d,isquiver,options)
+	Apply_options_tensor(md,options,type,'xz')
 	subplot(3*width,3*width,index6),
-	plot_unit(x,y,z,elements,tensor.yz,isongrid,is2d,isquiver,options_structure)
-	Apply_options_tensor(md,options_structure,type,'yz')
+	plot_unit(x,y,z,elements,tensor.yz,isongrid,is2d,isquiver,options)
+	Apply_options_tensor(md,options,type,'yz')
 end
 end
 
-function Apply_options_tensor(md,options_structure,type,component)
+function Apply_options_tensor(md,options,type,component)
 	%apply options
-	if isnan(options_structure.title)
-		if ismember('_',type) %user plotet stress_tensor
-			strings=strsplit(type,'_');
-			string=strings{1};
-		else %default plot: user requested stress
-			string=type;
-		end
-		options_structure.title=[upper(string(1)) string(2:end) ' ' component];
-	end 
-	applyoptions(md,[],options_structure);
+	if ismember('_',type) %user plotet stress_tensor
+		strings=strsplit(type,'_');
+		string=strings{1};
+	else %default plot: user requested stress
+		string=type;
+	end
+	options=addfielddefault(options,'title',[upper(string(1)) string(2:end) ' ' component]);
+	applyoptions(md,[],options);
 end
Index: /issm/trunk/src/m/classes/public/plot/plot_tensor_principal.m
===================================================================
--- /issm/trunk/src/m/classes/public/plot/plot_tensor_principal.m	(revision 2438)
+++ /issm/trunk/src/m/classes/public/plot/plot_tensor_principal.m	(revision 2439)
@@ -1,7 +1,7 @@
-function plot_tensor_principal(md,options_structure,width,i,tensor,type,plot_options);
+function plot_tensor_principal(md,options,width,i,tensor,type,plot_options);
 %PLOT_TENSOR_PRINCIPAL - plot principal values
 %
 %   Usage:
-%      plot_tensor_principal(md,options_structure,width,i,tensor,type,plot_options);
+%      plot_tensor_principal(md,options,width,i,tensor,type,plot_options);
 %
 %   See also: PLOTMODEL, PLOT_UNIT, PLOT_MANAGER
@@ -28,51 +28,49 @@
 %plot principal axis
 type1=[type 'axis1'];
-plot_tensor_principalaxis(md,options_structure,newwidth,index1,tensor,type1,plot_options);
+plot_tensor_principalaxis(md,options,newwidth,index1,tensor,type1,plot_options);
 type2=[type 'axis2'];
-plot_tensor_principalaxis(md,options_structure,newwidth,index2,tensor,type2,plot_options);
+plot_tensor_principalaxis(md,options,newwidth,index2,tensor,type2,plot_options);
 if  strcmpi(md.type,'3d')
 	type3=[type 'axis3'];
-	plot_tensor_principalaxis(md,options_structure,newwidth,index3,tensor,type3,plot_options);
+	plot_tensor_principalaxis(md,options,newwidth,index3,tensor,type3,plot_options);
 end
 
 %now plot principal values
-[x y z elements is2d]=processmesh(md,options_structure);
-[tensor.principalvalue1 isongrid isquiver]=processdata(md,tensor.principalvalue1,options_structure);
-[tensor.principalvalue2 isongrid isquiver]=processdata(md,tensor.principalvalue2,options_structure);
+[x y z elements is2d]=processmesh(md,options);
+[tensor.principalvalue1 isongrid isquiver]=processdata(md,tensor.principalvalue1,options);
+[tensor.principalvalue2 isongrid isquiver]=processdata(md,tensor.principalvalue2,options);
 if  strcmpi(md.type,'3d')
-	[tensor.principalvalue3 isongrid isquiver]=processdata(md,tensor.principalvalue3,options_structure);
+	[tensor.principalvalue3 isongrid isquiver]=processdata(md,tensor.principalvalue3,options);
 end
 
 if (strcmpi(md.type,'2d')),
 	subplot(2*width,2*width,index3)
-	plot_unit(x,y,z,elements,tensor.principalvalue1,isongrid,is2d,isquiver,options_structure)
-	Apply_options_tensor(md,options_structure,type,'principal value 1')
+	plot_unit(x,y,z,elements,tensor.principalvalue1,isongrid,is2d,isquiver,options)
+	Apply_options_tensor(md,options,type,'principal value 1')
 	subplot(2*width,2*width,index4)
-	plot_unit(x,y,z,elements,tensor.principalvalue2,isongrid,is2d,isquiver,options_structure)
-	Apply_options_tensor(md,options_structure,type,'principal value 2')
+	plot_unit(x,y,z,elements,tensor.principalvalue2,isongrid,is2d,isquiver,options)
+	Apply_options_tensor(md,options,type,'principal value 2')
 else
 	subplot(3*width,3*width,index4)
-	plot_unit(x,y,z,elements,tensor.principalvalue1,isongrid,is2d,isquiver,options_structure)
-	Apply_options_tensor(md,options_structure,type,'principal value 1')
+	plot_unit(x,y,z,elements,tensor.principalvalue1,isongrid,is2d,isquiver,options)
+	Apply_options_tensor(md,options,type,'principal value 1')
 	subplot(3*width,3*width,index5)
-	plot_unit(x,y,z,elements,tensor.principalvalue2,isongrid,is2d,isquiver,options_structure)
-	Apply_options_tensor(md,options_structure,type,'principal value 2')
+	plot_unit(x,y,z,elements,tensor.principalvalue2,isongrid,is2d,isquiver,options)
+	Apply_options_tensor(md,options,type,'principal value 2')
 	subplot(3*width,3*width,index6)
-	plot_unit(x,y,z,elements,tensor.principalvalue3,isongrid,is2d,isquiver,options_structure)
-	Apply_options_tensor(md,options_structure,type,'principal value 3')
+	plot_unit(x,y,z,elements,tensor.principalvalue3,isongrid,is2d,isquiver,options)
+	Apply_options_tensor(md,options,type,'principal value 3')
 end
 end
 
-function Apply_options_tensor(md,options_structure,type,component)
+function Apply_options_tensor(md,options,type,component)
 %apply options
-	if isnan(options_structure.title)
-		if ismember('_',type) %user plotet stress_tensor
-			strings=strsplit(type,'_');
-			string=strings{1};
-		else %default plot: user requested stress
-			string=type;
-		end
-		options_structure.title=[upper(string(1)) string(2:end) ' ' component];
-	end
-	applyoptions(md,[],options_structure);
+if ismember('_',type) %user plotet stress_tensor
+	strings=strsplit(type,'_');
+	string=strings{1};
+else %default plot: user requested stress
+	string=type;
 end
+options=addfielddefault(options,'title',[upper(string(1)) string(2:end) ' ' component]);
+	applyoptions(md,[],options);
+end
Index: /issm/trunk/src/m/classes/public/plot/plot_tensor_principalaxis.m
===================================================================
--- /issm/trunk/src/m/classes/public/plot/plot_tensor_principalaxis.m	(revision 2438)
+++ /issm/trunk/src/m/classes/public/plot/plot_tensor_principalaxis.m	(revision 2439)
@@ -1,7 +1,7 @@
-function plot_tensor_principalaxis(md,options_structure,width,i,tensor,type,plot_options);
+function plot_tensor_principalaxis(md,options,width,i,tensor,type,plot_options);
 %PLOT_TENSOR_PRINCIPALAXIS - plot ytensor principal axis
 %
 %   Usage:
-%      plot_tensor_principalaxis(md,options_structure,width,i);
+%      plot_tensor_principalaxis(md,options,width,i);
 %
 %   See also: PLOTMODEL
@@ -11,18 +11,18 @@
 
 %process data and model
-[x y z elements is2d]=processmesh(md,options_structure);
+[x y z elements is2d]=processmesh(md,options);
 
 if (strcmpi(md.type,'2d')),
 	eval(['Vx=tensor.principalaxis' type(end) '(:,1); Vy=tensor.principalaxis' type(end) '(:,2);'])
 	eval(['value=tensor.principalvalue' type(end) ';']);
-	[Vx isongrid isquiver]=processdata(md,Vx,options_structure);
-	[Vy isongrid isquiver]=processdata(md,Vy,options_structure);
-	[value isongrid isquiver]=processdata(md,value,options_structure);
+	[Vx isongrid isquiver]=processdata(md,Vx,options);
+	[Vy isongrid isquiver]=processdata(md,Vy,options);
+	[value isongrid isquiver]=processdata(md,value,options);
 else
 	eval(['Vx=tensor.principalaxis' type(end) '(:,1); Vy=tensor.principalaxis' type(end) '(:,2); Vz=tensor.principalaxis' type(end) '(:,3);'])
-	[Vx isongrid isquiver]=processdata(md,Vx,options_structure);
-	[Vy isongrid isquiver]=processdata(md,Vy,options_structure);
-	[Vz isongrid isquiver]=processdata(md,Vz,options_structure);
-	[value isongrid isquiver]=processdata(md,value,options_structure);
+	[Vx isongrid isquiver]=processdata(md,Vx,options);
+	[Vy isongrid isquiver]=processdata(md,Vy,options);
+	[Vz isongrid isquiver]=processdata(md,Vz,options);
+	[value isongrid isquiver]=processdata(md,value,options);
 end
 
@@ -36,10 +36,11 @@
 
 	%density
-	if ~isnan(options_structure.density)
-		x=x(1:options_structure.density:end);
-		y=y(1:options_structure.density:end);
-		Vx=Vx(1:options_structure.density:end);
-		Vy=Vy(1:options_structure.density:end);
-		value=value(1:options_structure.density:end);
+	if exist(options,'density')
+		density=getfieldvalue(options,'density');
+		x=x(1:density:end);
+		y=y(1:density:end);
+		Vx=Vx(1:density:end);
+		Vy=Vy(1:density:end);
+		value=value(1:density:end);
 	end
 
@@ -57,12 +58,13 @@
 else
 	%density
-	if ~isnan(options_structure.density)
-		x=x(1:options_structure.density:end);
-		y=y(1:options_structure.density:end);
-		z=z(1:options_structure.density:end);
-		Vx=Vx(1:options_structure.density:end);
-		Vy=Vy(1:options_structure.density:end);
-		Vz=Vz(1:options_structure.density:end);
-		value=value(1:options_structure.density:end);
+	if exist(options,'density')
+		density=getfieldvalue(options,'density');
+		x=x(1:density:end);
+		y=y(1:density:end);
+		z=z(1:density:end);
+		Vx=Vx(1:density:end);
+		Vy=Vy(1:density:end);
+		Vz=Vz(1:density:end);
+		value=value(1:density:end);
 	end
 
@@ -87,11 +89,7 @@
 
 %apply options
-if isnan(options_structure.title)
-	strings=strsplit(type,'_');
-	string=strings{1};
-	options_structure.title=[upper(string(1)) string(2:end) ' principal axis ' type(end)];
-end 
-if isnan(options_structure.colorbar)
-	options_structure.colorbar=0;
-end
-applyoptions(md,[],options_structure);
+strings=strsplit(type,'_');
+string=strings{1};
+options=addfielddefault(options,'title',[upper(string(1)) string(2:end) ' principal axis ' type(end)]);
+options=addfielddefault(options,'colorbar',0);
+applyoptions(md,[],options);
Index: /issm/trunk/src/m/classes/public/plot/plot_thermaltransient_results.m
===================================================================
--- /issm/trunk/src/m/classes/public/plot/plot_thermaltransient_results.m	(revision 2438)
+++ /issm/trunk/src/m/classes/public/plot/plot_thermaltransient_results.m	(revision 2439)
@@ -1,7 +1,7 @@
-function plot_thermaltransient_results(md,options_structure,width,i)
+function plot_thermaltransient_results(md,options,width,i)
 %PLOT_THERMALTRANSIENT_RESULTS - plot  results of a thermal transient solution
 %
 %   Usage:
-%      plot_thermaltransient_results(md,options_structure,width,i);
+%      plot_thermaltransient_results(md,options,width,i);
 %
 %   See also: PLOTMODEL
@@ -11,5 +11,5 @@
 	string=[string ',''data'',''thermaltransient_results(' num2str(i) ').temperature'',''view'',3,''title'',''Temperature at time ' num2str(md.thermaltransient_results(i).time) ' a'''];
 end
-string=[string ',''figure'',1,''colorbar#all'',''on'',''view'',3,''fontsize'',' num2str(options_structure.fontsize) ',''fontweight'',' options_structure.fontweight ');'];
+string=[string ',''figure'',1,''colorbar#all'',''on'',''view'',3,''fontsize'',' num2str(options.fontsize) ',''fontweight'',' options.fontweight ');'];
 eval(string);
 clear string;
@@ -19,5 +19,5 @@
 	string=[string ',''data'',md.thermaltransient_results(' num2str(i) ').temperature-md.thermaltransient_results(' num2str(i-1) ').temperature,''view'',3,''title'',''Delta temperature at time ' num2str(md.thermaltransient_results(i).time) ' a'''];
 end
-string=[string ',''figure'',2,''colorbar#all'',''on'',''fontsize'',' num2str(options_structure.fontsize) ',''fontweight'',' options_structure.fontweight ');'];
+string=[string ',''figure'',2,''colorbar#all'',''on'',''fontsize'',' num2str(options.fontsize) ',''fontweight'',' options.fontweight ');'];
 eval(string);
 clear string;
Index: /issm/trunk/src/m/classes/public/plot/plot_transient_movie.m
===================================================================
--- /issm/trunk/src/m/classes/public/plot/plot_transient_movie.m	(revision 2438)
+++ /issm/trunk/src/m/classes/public/plot/plot_transient_movie.m	(revision 2439)
@@ -1,6 +1,6 @@
-function plot_transient_movie(md,options_structure,width,i);
+function plot_transient_movie(md,options,width,i);
 %PLOT_TRANSIENT_MOVIE - plot a transient result as a movie
 %   Usage:
-%      plot_transient_movie(md,options_structure,width,i);
+%      plot_transient_movie(md,options,width,i);
 %
 %   See also: PLOTMODEL, PLOT_UNIT, PLOT_MANAGER
@@ -10,6 +10,6 @@
 
 	%xlim
-	if ~isnan(options_structure.transient_movie_field),
-		field=options_structure.transient_movie_field;
+	if ~exist(options,'transient_movie_field'),
+		field=getfieldvalue(options,'transient_movie_field');
 	else
 		error('specify transient_movie_field in options list');
@@ -17,5 +17,5 @@
 
 	%process model
-	[x y z elements is2d]=processmesh(md,options_structure);
+	[x y z elements is2d]=processmesh(md,options);
 
 	%loop over the time steps
@@ -24,10 +24,10 @@
 
 		%process data
-		[data isongrid isquiver]=processdata(md,data,options_structure);
+		[data isongrid isquiver]=processdata(md,data,options);
 		titlestring=[field ' at time ' num2str(md.results.transient(i).time) ' year'];
-		plot_unit(x,y,z,elements,data,isongrid,is2d,isquiver,options_structure)
-		apply_options_movie(md,options_structure,titlestring);
+		plot_unit(x,y,z,elements,data,isongrid,is2d,isquiver,options)
+		apply_options_movie(md,options,titlestring);
 		
-		if ~isnan(options_structure.transient_movie_output),
+		if exist(options,'transient_movie_output'),
 			set(gcf,'Renderer','zbuffer','color','white'); %fixes a bug on Mac OS X (not needed in future Matlab version)
 			if i==1,
@@ -46,19 +46,15 @@
 
 	%output movie if requested.
-	if ~isnan(options_structure.transient_movie_output),
-		filename=options_structure.transient_movie_output;
-		imwrite(images,map,filename,'DelayTime',options_structure.transient_movie_time,'LoopCount',inf)
+	if exist(options,'transient_movie_output'),
+		filename=getfieldvalue(options,'transient_movie_output');
+		imwrite(images,map,filename,'DelayTime',getfieldvalue(options,'transient_movie_time',2),'LoopCount',inf)
 	end
 
 end %function
 
-function apply_options_movie(md,options_structure,titlestring)
+function apply_options_movie(md,options,titlestring)
 	%apply options
-	if isnan(options_structure.title)
-		options_structure.title=titlestring;
-	end 
-	if isnan(options_structure.colorbar)
-		options_structure.colorbar=1;
-	end
-	applyoptions(md,[],options_structure);
+	options=addfielddefault(options,'title',titlestring);
+	options=addfielddefault(options,'colorbar',1);
+	applyoptions(md,[],options);
 end
Index: /issm/trunk/src/m/classes/public/plot/plot_transient_results.m
===================================================================
--- /issm/trunk/src/m/classes/public/plot/plot_transient_results.m	(revision 2438)
+++ /issm/trunk/src/m/classes/public/plot/plot_transient_results.m	(revision 2439)
@@ -1,9 +1,12 @@
-function plot_transient_results(md,options_structure,width,i)
+function plot_transient_results(md,options,width,i)
 %PLOT_TRANSIENT_RESULTS - plot transient results
 %
 %   Usage:
-%      plot_transient_results(md,options_structure,width,i);
+%      plot_transient_results(md,options,width,i);
 %
 %   See also: PLOTMODEL
+
+fontsize=getfieldvalue(options,'fontsize',14);
+fontweight=getfieldvalue(options,'fontweight','n');
 
 %Prepare window distribution
@@ -26,5 +29,5 @@
 	string=[string ',''data'',md.results.transient(' num2str(i) ').thickness,''title'',''Thickness at time ' num2str(md.results.transient(i).time) ' a'''];
 end
-string=[string ',''figure'',1,''colorbar#all'',''on'',''fontsize'',' num2str(options_structure.fontsize) ',''fontweight'',' num2str(options_structure.fontweight) ');'];
+string=[string ',''figure'',1,''colorbar#all'',''on'',''fontsize'',' fontsize ',''fontweight'',' fontweight ');'];
 eval(string);
 clear string;
@@ -34,5 +37,5 @@
 	string=[string ',''data'',md.results.transient(' num2str(i) ').vel,''view'',3,''title'',''Velocity at time ' num2str(md.results.transient(i).time) ' a'''];
 end
-string=[string ',''figure'',2,''colorbar#all'',''on'',''fontsize'',' num2str(options_structure.fontsize) ',''fontweight'',' num2str(options_structure.fontweight)  ');'];
+string=[string ',''figure'',2,''colorbar#all'',''on'',''fontsize'',' fontsize ',''fontweight'',' fontweight  ');'];
 eval(string);
 clear string;
@@ -43,5 +46,5 @@
 		string=[string ',''data'',md.results.transient(' num2str(i) ').temperature,''view'',3,''title'',''Temperature at time ' num2str(md.results.transient(i).time) ' a'''];
 	end
-	string=[string ',''figure'',3,''colorbar#all'',''on'',''view'',3,''fontsize'',' num2str(options_structure.fontsize) ',''fontweight'',' num2str(options_structure.fontweight)  ');'];
+	string=[string ',''figure'',3,''colorbar#all'',''on'',''view'',3,''fontsize'',' fontsize ',''fontweight'',' fontweight  ');'];
 	eval(string);
 	clear string;
@@ -52,5 +55,5 @@
 	string=[string ',''data'',md.results.transient(' num2str(i) ').thickness-md.results.transient(' num2str(i-1) ').thickness,''title'',''Delta thickness at time ' num2str(md.results.transient(i).time) ' a'''];
 end
-string=[string ',''figure'',4,''colorbar#all'',''on'',''fontsize'',' num2str(options_structure.fontsize) ',''fontweight'',' num2str(options_structure.fontweight)  ');'];
+string=[string ',''figure'',4,''colorbar#all'',''on'',''fontsize'',' fontsize ',''fontweight'',' fontweight  ');'];
 eval(string);
 clear string;
@@ -60,5 +63,5 @@
 	string=[string ',''data'',md.results.transient(' num2str(i) ').vel-md.results.transient(' num2str(i-1) ').vel,''view'',3,''title'',''Delta velocity at time ' num2str(md.results.transient(i).time) ' a'''];
 end
-string=[string ',''figure'',5,''colorbar#all'',''on'',''fontsize'',' num2str(options_structure.fontsize) ',''fontweight'',' num2str(options_structure.fontweight)  ');'];
+string=[string ',''figure'',5,''colorbar#all'',''on'',''fontsize'',' fontsize ',''fontweight'',' fontweight  ');'];
 eval(string);
 clear string;
@@ -69,5 +72,5 @@
 		string=[string ',''data'',md.results.transient(' num2str(i) ').temperature-md.results.transient(' num2str(i-1) ').temperature,''view'',3,''title'',''Delta temperature at time ' num2str(md.results.transient(i).time) ' a'''];
 	end
-	string=[string ',''figure'',6,''colorbar#all'',''on'',''fontsize'',' num2str(options_structure.fontsize) ',''fontweight'',' num2str(options_structure.fontweight)  ');'];
+	string=[string ',''figure'',6,''colorbar#all'',''on'',''fontsize'',' fontsize ',''fontweight'',' fontweight  ');'];
 	eval(string);
 	clear string;
Index: /issm/trunk/src/m/classes/public/plot/plot_unit.m
===================================================================
--- /issm/trunk/src/m/classes/public/plot/plot_unit.m	(revision 2438)
+++ /issm/trunk/src/m/classes/public/plot/plot_unit.m	(revision 2439)
@@ -1,16 +1,12 @@
-function plot_unit(x,y,z,elements,data,isongrid,is2d,isquiver,options_structure)
+function plot_unit(x,y,z,elements,data,isongrid,is2d,isquiver,options)
 %PLOT_UNIT - unit plot, display data
 %
 %   Usage:
-%      plot_unit(x,y,z,elements,data,isongrid,is2d,isquiver,options_structure);
+%      plot_unit(x,y,z,elements,data,isongrid,is2d,isquiver,options);
 %
 %   See also: PLOTMODEL, PLOT_MANAGER
 
-%edgecolor?
-if ~isnan(options_structure.edgecolor),
-	edgecolor=options_structure.edgecolor;
-else
-	edgecolor='none';
-end
+%edgecolor
+edgecolor=getfieldvalue(options,'edgecolor','none');
 
 %regular plot
@@ -53,7 +49,7 @@
 	if isongrid,
 		if is2d,
-			plot_quiver(x,y,data(:,1),data(:,2),options_structure);
+			plot_quiver(x,y,data(:,1),data(:,2),options);
 		else
-			plot_quiver3(x,y,z,data(:,1),data(:,2),data(:,3),options_structure);
+			plot_quiver3(x,y,z,data(:,1),data(:,2),data(:,3),options);
 		end
 	else
Index: /issm/trunk/src/m/classes/public/plot/plotmodel.m
===================================================================
--- /issm/trunk/src/m/classes/public/plot/plotmodel.m	(revision 2438)
+++ /issm/trunk/src/m/classes/public/plot/plotmodel.m	(revision 2439)
@@ -7,27 +7,17 @@
 end
 
-%First go through varargin and  figure out how many subplots we are going to make
-datavalues=findarg(varargin,'data');
-numberofplots=length(datavalues);
-subplotwidth=ceil(sqrt(numberofplots));
+%First process options
+options=plotoptions(varargin{:});
 
-%Get figure number 
-figurevalues=findarg(varargin,'figure');
-if ~isempty(figurevalues),
-	if length(figurevalues)>1,
-		error('plotmodel error message: only one figure allowed');
-	else
-		figurenumber=figurevalues.value;
-	end
-else
-	figurenumber=1;
-end
+%get numberof subplot
+subplotwidth=ceil(sqrt(options.numberofplots));
+
+%Get figure number and number of plots
+figurenumber=options.figurenumber;
+numberofplots=options.numberofplots;
 
 %go through subplots
 if numberofplots,
 		
-	%recover options  for all subplots.
-	options=recover_plot_options(md,varargin,numberofplots);
-	
 	%Create figure 
 	figure(figurenumber),clf;
@@ -37,5 +27,5 @@
 
 		%call unit plot
-		plot_manager(md,options{i},subplotwidth,i);
+		plot_manager(md,options.list{i},subplotwidth,i);
 
 	end
Index: /issm/trunk/src/m/classes/public/plot/processdata.m
===================================================================
--- /issm/trunk/src/m/classes/public/plot/processdata.m	(revision 2438)
+++ /issm/trunk/src/m/classes/public/plot/processdata.m	(revision 2439)
@@ -1,7 +1,7 @@
-function [data isongrid isquiver]=processdata(md,data,options_structure);
+function [data isongrid isquiver]=processdata(md,data,options);
 %PROCESSDATA - process data to be plotted
 %
 %   Usage:
-%      [data isongrid isquiver]=processdata(md,data,options_structure);
+%      [data isongrid isquiver]=processdata(md,data,options);
 %
 %   See also: PLOTMODEL, PROCESSMESH
@@ -67,6 +67,7 @@
 
 %smoothing?
-if ~isnan(options_structure.smooth)
-	data=averaging(md,data,options_structure.smooth);
+if exist(options,'smooth')
+	data=averaging(md,data,getfieldvalue(options,'smooth'));
+	datasize(1)=md.numberofgrids;
 	%---> go to grid data
 end
@@ -77,19 +78,19 @@
 
 	%ice sheet only?
-	if ~isnan(options_structure.noiceshelf) & options_structure.noiceshelf,
+	if getfieldvalue(options,'iceshelf',0),
 		data(find(md.elementoniceshelf),:)=NaN;
 	end
 	%ice shelf only?
-	if ~isnan(options_structure.noicesheet) & options_structure.noicesheet,
+	if getfieldvalue(options,'icesheet',0),
 		data(find(~md.elementoniceshelf),:)=NaN;
 	end
 	%no water?
-	if ~isnan(options_structure.nowater) & options_structure.nowater,
+	if getfieldvalue(options,'water',0),
 		data(find(md.elementonwater),:)=NaN;
 	end
 	%log?
-	if ~isnan(options_structure.log),
+	if exist(options,'log'),
 		pos=find(~isnan(data));
-		data(pos)=log(data(pos))/log(options_structure.log);
+		data(pos)=log(data(pos))/log(getfieldvalue(options,'log'));
 	end
 end
@@ -99,21 +100,21 @@
 	isongrid=1;
 	%ice sheet only?
-	if ~isnan(options_structure.noiceshelf) & options_structure.noiceshelf,
+	if getfieldvalue(options,'iceshelf',0),
 		pos=find(md.gridoniceshelf);
 		data(pos,:)=NaN;
 	end
 	%ice shelf only?
-	if ~isnan(options_structure.noiceshelf) & options_structure.noicesheet,
+	if getfieldvalue(options,'icesheet',0),
 		pos=find(md.gridonicesheet);
 		data(pos,:)=NaN;
 	end
 	%no water?
-	if ~isnan(options_structure.nowater) & options_structure.nowater,
+	if getfieldvalue(options,'water',0),
 		pos=find(md.gridonwater);
 		data(pos,:)=NaN;
 	end
 	%log?
-	if ~isnan(options_structure.log),
-		data=log(data)/log(options_structure.log);
+	if exist(options,'log'),
+		data=log(data)/log(getfieldvalue(options,'log'));
 	end
 
@@ -121,13 +122,14 @@
 
 %layer projection? 
-if ~isnan(options_structure.layer) & options_structure.layer>=1,
-	data=project2d(md,data,options_structure.layer); %project onto 2d mesh
+if getfieldvalue(options,'layer',0)>=1,
+	data=project2d(md,data,getfieldvalue(options,'layer')); %project onto 2d mesh
 end
 
 %control arrow density if quiverplot
-if isquiver & ~isnan(options_structure.density)
+if isquiver & exist(options,'density')
 	databak=data;
 	data=NaN*ones(datasize);
-	data(1:options_structure.density:end,:)=databak(1:options_structure.density:end,:);
+	density=getfieldvalue(options,'density');
+	data(1:density:end,:)=databak(1:density:end,:);
 	clear databak
 end
Index: /issm/trunk/src/m/classes/public/plot/processmesh.m
===================================================================
--- /issm/trunk/src/m/classes/public/plot/processmesh.m	(revision 2438)
+++ /issm/trunk/src/m/classes/public/plot/processmesh.m	(revision 2439)
@@ -1,7 +1,7 @@
-function [x y z elements is2d]=processmesh(md,options_structure);
+function [x y z elements is2d]=processmesh(md,options);
 %PROCESSMESH - process mesh to be plotted
 %
 %   Usage:
-%      [x y z elements is2d]=processmesh(md,options_structure)
+%      [x y z elements is2d]=processmesh(md,options)
 %
 %   See also: PLOTMODEL, PROCESSDATA
@@ -27,5 +27,5 @@
 	is2d=1;
 else
-	if ~isnan(options_structure.layer) & options_structure.layer>=1,
+	if getfieldvalue(options,'layer',0)>=1,
 		is2d=1;
 	else
@@ -35,5 +35,5 @@
 
 %layer projection? 
-if ~isnan(options_structure.layer) & options_structure.layer>=1,
+if getfieldvalue(options,'layer',0)>=1,
 	%we modify the mesh temporarily to a 2d mesh from which the 3d mesh was extruded. 
 	x=x2d;
@@ -45,7 +45,8 @@
 
 %units
-if ~isnan(options_structure.unitmultiplier),
-	x=x*options_structure.unitmultiplier;
-	y=y*options_structure.unitmultiplier;
-	z=z*options_structure.unitmultiplier;
+if exist(options,'unit'),
+	unit=getfieldvalue(options,'unit');
+	x=x*unit;
+	y=y*unit;
+	z=z*unit;
 end
Index: sm/trunk/src/m/classes/public/plot/recover_plot_options.m
===================================================================
--- /issm/trunk/src/m/classes/public/plot/recover_plot_options.m	(revision 2438)
+++ 	(revision )
@@ -1,102 +1,0 @@
-function plotoptions=recover_plot_options(md,varargin,numberofplots);
-%RECOVER_PLOT_OPTIONS - recover plot options
-%
-%   Usage:
-%      plotoptions=recover_plot_options(md,varargin,numberofplots);
-%
-%   See also: PARSE_OPTIONS, PLOTMODEL
-
-%initialize options string.
-plotoptions=cell(numberofplots,1);
-
-%initialize options.
-options=cell(0,2);
-
-for i=1:size(plotoptions,1),
-	plotoptions{i}=options;
-end
-
-%make sure length(varargin) is even
-if mod(length(varargin),2),
-	error('recover_plot_options error message: an even number of options is necessary');
-end
-
-%go through varargin, extract options and plug them into subplot options, by order of appearance
-for i=1:length(varargin)/2,
-
-	optionstring=varargin{2*i-1};
-	optionvalue=varargin{2*i};
-
-	if length(optionstring)>4 & strcmpi(optionstring(end-3:end),'#all'),
-		optionstring=optionstring(1:end-4);
-		for j=1:size(plotoptions,1), 
-			ispresent=0;
-			options_j=plotoptions{j};
-			for k=1:size(options_j,1),
-				if strcmpi(options_j{k,1},optionstring),
-					options_j{k,2}=optionvalue;
-					ispresent=1;
-				end
-			end
-			plotoptions{j}=options_j;
-
-			if ~ispresent,
-				options_j{end+1,1}=optionstring;
-				options_j{end,2}=optionvalue;
-				plotoptions{j}=options_j;
-			end
-		end
-	else
-		
-		%look for an a pound sign that would enforce choice of plot number
-		if length(optionstring)>2 & strcmpi(optionstring(end-1),'#'),
-			optionstring(end-1);
-			plotnum=str2num(optionstring(end));
-			options_j=plotoptions{plotnum};
-			options_j{end+1,1}=optionstring(1:end-2);
-			options_j{end,2}=optionvalue;
-			plotoptions{plotnum}=options_j;
-		else
-			for j=1:numberofplots,
-				options_j=plotoptions{j};
-
-				alreadypresent=0;
-				for k=1:size(options_j,1),
-					if strcmpi(optionstring,options_j{k,1}),
-						alreadypresent=1;
-						break;
-					else
-						alreadypresent=0;
-					end
-				end
-				if alreadypresent,
-					continue;
-				else
-					options_j{end+1,1}=optionstring;
-					options_j{end,2}=optionvalue;
-					plotoptions{j}=options_j;
-					break;
-				end
-			end
-		end
-	end
-end
-
-for i=1:length(plotoptions),
-	options_i=plotoptions{i};
-	new_options_i=cell(1,size(options_i,1)*size(options_i,2));
-	counter=1;
-	for j=1:size(options_i,1),
-		new_options_i{counter}=options_i{j,1};
-		new_options_i{counter+1}=options_i{j,2};
-		counter=counter+2;
-	end
-	plotoptions{i}=new_options_i;
-end
-
-%%DEBUG
-%for i=1:length(plotoptions),
-%	disp(['Options ' num2str(i)]);
-%	plotoptions{i}
-%end
-%error('debug')
