Mercurial > hg > octave-lyh
comparison scripts/plot/isaxes.m @ 17127:bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
* scripts/plot/isaxes.m: New function.
* scripts/plot/module.mk: Add function to build system.
* NEWS: Announce new function.
* doc/interpreter/plot.txi: Add function to manual.
* libinterp/corefcn/graphics.cc(Fishandle), scripts/plot/isfigure.m:
Update seealso links to mention isaxes.
author | Rik <rik@octave.org> |
---|---|
date | Wed, 31 Jul 2013 14:18:00 -0700 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
17126:eaab03308c0b | 17127:bcada0a4f8a7 |
---|---|
1 ## Copyright (C) 2013 Rik Wehbring | |
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 3 of the License, or (at | |
8 ## your option) 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, see | |
17 ## <http://www.gnu.org/licenses/>. | |
18 | |
19 ## -*- texinfo -*- | |
20 ## @deftypefn {Function File} {} isaxes (@var{h}) | |
21 ## Return true if @var{h} is an axes graphics handle and false otherwise. | |
22 ## | |
23 ## If @var{h} is a matrix then return a logical array which is true where | |
24 ## the elements of @var{h} are axes graphics handles and false where | |
25 ## they are not. | |
26 ## @seealso{isaxes, ishandle} | |
27 ## @end deftypefn | |
28 | |
29 ## Author: jwe | |
30 | |
31 function retval = isaxes (h) | |
32 | |
33 if (nargin != 1) | |
34 print_usage (); | |
35 endif | |
36 | |
37 hlist = ishandle (h); | |
38 if (any (hlist)) | |
39 retval(hlist) = strcmp (get (h(hlist), "type"), "axes"); | |
40 else | |
41 retval = hlist; | |
42 endif | |
43 | |
44 endfunction | |
45 | |
46 | |
47 %!test | |
48 %! hf = figure ("visible", "off"); | |
49 %! unwind_protect | |
50 %! hax = axes (); | |
51 %! assert (isaxes (hax)); | |
52 %! assert (! isaxes (-hax)); | |
53 %! unwind_protect_cleanup | |
54 %! close (hf); | |
55 %! end_unwind_protect | |
56 |