comparison scripts/plot/close.m @ 4225:fa4dfbc33ce5

[project @ 2002-12-18 03:07:48 by jwe]
author jwe
date Wed, 18 Dec 2002 03:07:48 +0000
parents
children eafca8134ab6
comparison
equal deleted inserted replaced
4224:0179e6309248 4225:fa4dfbc33ce5
1 ## Copyright (C) 2002 John W. Eaton
2 ##
3 ## This file is part of Octave.
4 ##
5 ## Octave is free software; you can redistribute it and/or modify it
6 ## under the terms of the GNU General Public License as published by
7 ## the Free Software Foundation; either version 2, or (at your option)
8 ## any later version.
9 ##
10 ## Octave is distributed in the hope that it will be useful, but
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 ## General Public License for more details.
14 ##
15 ## You should have received a copy of the GNU General Public License
16 ## along with Octave; see the file COPYING. If not, write to the Free
17 ## Software Foundation, 59 Temple Place - Suite 330, Boston, MA
18 ## 02111-1307, USA.
19
20 ## -*- texinfo -*-
21 ## @deftypefn {Command} {} close
22 ## @deftypefnx {Command} {} close all
23 ## Close the plot window(s).
24 ## @end deftypefn
25
26 ## Author: jwe
27
28 ## mark_as_command: close
29
30 function retval = close (arg1, arg2)
31
32 static warned_all = false;
33 static warned_name = false;
34 static warned_handle = false;
35
36 if (nargin == 0)
37 if (! warned_all)
38 warned_all = true;
39 warning ("close: unable to close only current plot window");
40 endif
41 closeplot;
42 elseif (nargin == 1)
43 if (isstr (arg1))
44 if (strcmp (arg1, "all"))
45 closeplot;
46 else
47 if (! warned_name)
48 warned_name = true;
49 warning ("close: unable to close plot windows by name");
50 endif
51 endif
52 else
53 if (! warned_handle)
54 warned_handle = true;
55 warning ("close: unable to close plot windows by handle");
56 endif
57 endif
58 elseif (nargin == 2
59 && isstr (arg1) && strcmp (arg1, "all")
60 && isstr (arg2) && strcmp (arg2, "hidden"))
61 closeplot;
62 else
63 usage ("close [all]");
64 endif
65
66 if (nargout > 0)
67 retval = 1;
68 endif
69
70 endfunction