Index: /issm/trunk/src/m/utils/Exp/expmaster.m
===================================================================
--- /issm/trunk/src/m/utils/Exp/expmaster.m	(revision 284)
+++ /issm/trunk/src/m/utils/Exp/expmaster.m	(revision 285)
@@ -65,16 +65,20 @@
 
 %get current figure
-set(gcf,'Renderer','zbuffer'); %fixes a bug on Mac OS X (not needed in future Matlab version
-F=getframe(gca);
-F=F.cdata;
-%get current axis
-xlim=get(gca,'Xlim');
-ylim=get(gca,'Ylim');
-%recreate x_m and y_m
-x_m=linspace(xlim(1),xlim(2),size(F,2));
-y_m=linspace(ylim(2),ylim(1),size(F,1)); %getframe reverse axis...
-%plot the data in another figure
-figure
-imagesc(x_m,y_m,F); set(gca,'Ydir','normal');
+if ~isempty(get(0,'children')),%if there is already a figure (return the number of opened figures)
+	set(gcf,'Renderer','zbuffer'); %fixes a bug on Mac OS X (not needed in future Matlab version)
+	F=getframe(gca);
+	F=F.cdata;
+	%get current axis
+	xlim=get(gca,'Xlim');
+	ylim=get(gca,'Ylim');
+	%recreate x_m and y_m
+	x_m=linspace(xlim(1),xlim(2),size(F,2));
+	y_m=linspace(ylim(2),ylim(1),size(F,1)); %getframe reverse axis...
+	%plot the data in another figure
+	figure
+	imagesc(x_m,y_m,F); set(gca,'Ydir','normal');
+else
+	figure
+end
 
 %plot existing profile if any
@@ -85,5 +89,5 @@
 	for i=1:numprofiles
 		plot(A(i).x,A(i).y,'-r','MarkerSize',10);
-		prevplot2=prevplot2+1;
+		max(A(i).x)
 	end
 end
