Mercurial > hg > octave-lyh
diff scripts/plot/close.m @ 6278:300fb48803e3
[project @ 2007-02-07 22:23:37 by jwe]
author | jwe |
---|---|
date | Wed, 07 Feb 2007 22:23:37 +0000 |
parents | 44c91c5dfe1d |
children | b298a4c12fc3 |
line wrap: on
line diff
--- a/scripts/plot/close.m +++ b/scripts/plot/close.m @@ -32,8 +32,12 @@ function retval = close (arg1, arg2) if (nargin == 0) - ## Close current figure. - figs = gcf (); + ## Close current figure. Don't use gcf because that will open a new + ## plot window if one doesn't exist. + figs = get (0, "currentfigure"); + if (! isempty (figs) && figs == 0) + figs = []; + endif elseif (nargin == 1) if (ischar (arg1) && strcmp (arg1, "all")) ## Close all figures.