undoplot

PURPOSE ^

UNDOPLOT - undo plot

SYNOPSIS ^

function undoplot(n)

DESCRIPTION ^

UNDOPLOT - undo plot

   o n>0 removes the last n figure items added
   o n<0 removes all the figures done after figure=-n
   undoplot to remove only the last figure

   Usage:
      undoplot(n)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function  undoplot(n)
0002 %UNDOPLOT - undo plot
0003 %
0004 %   o n>0 removes the last n figure items added
0005 %   o n<0 removes all the figures done after figure=-n
0006 %   undoplot to remove only the last figure
0007 %
0008 %   Usage:
0009 %      undoplot(n)
0010 
0011 %some checks on n
0012 if nargin==0
0013     n=1;
0014 end
0015 if ischar(n)
0016     n = sscanf(n,'%i');
0017 end
0018 
0019 %how many plots have been done?
0020 g=get(gca,'children');
0021 L=length(g);
0022 
0023 
0024 if n>0
0025     %erase plot
0026     for i=1:min(n,L)
0027         delete(g(i));
0028     end
0029 end
0030 
0031 if n<0
0032     %erase plot
0033     for i=1:min(L-n,L)
0034         delete(g(i));
0035     end
0036 end

Generated on Sun 29-Mar-2009 20:22:55 by m2html © 2003