help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

a sugested improvement to clf.m


From: Doug Stewart
Subject: a sugested improvement to clf.m
Date: Wed, 28 Nov 2007 22:53:32 -0500
User-agent: Thunderbird 1.5.0.13 (Windows/20070809)

This allows one to clear a figure that is not the current figure.
It is just a suggestion  but I know that I sure like it.



# Copyright (C) 2005, 2006, 2007 John W. Eaton
##
## This file is part of Octave.
##
## Octave is free software; you can redistribute it and/or modify it
## under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 3 of the License, or (at
## your option) any later version.
##
## Octave is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
## General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with Octave; see the file COPYING.  If not, see
## <http://www.gnu.org/licenses/>.

## -*- texinfo -*-
## @deftypefn {Function File} {} clf (   [n])
## clf()  Clear the current figure.
## clf(n) Clear figure #n but keep the current figure as current.
## @seealso{close, delete}
## @end deftypefn

## Author: jwe
## Modified: Doug Stewart Mov. 2007

function clf (n)
nargin
if(nargin>1)
  print_usage ();
endif

 if (nargin == 0)
   cf = gcf ();
   set (cf, "currentaxes", []);
   for k = get (cf, "children")
     if (ishandle (k))
       delete (k);
     endif
   endfor
 else
 oldf= gcf()
  figure(n)
  cf = gcf ();
   set (cf, "currentaxes", []);
   for k = get (cf, "children")
     if (ishandle (k))
       delete (k);
     endif
   endfor
   ## now go back to the origina current figure
   figure(oldf);
endif

endfunction


reply via email to

[Prev in Thread] Current Thread [Next in Thread]