Mercurial > hg > octave-lyh
annotate 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 |
rev | line source |
---|---|
17127
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
1 ## Copyright (C) 2013 Rik Wehbring |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
2 ## |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
3 ## This file is part of Octave. |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
4 ## |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
5 ## Octave is free software; you can redistribute it and/or modify it |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
6 ## under the terms of the GNU General Public License as published by |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
7 ## the Free Software Foundation; either version 3 of the License, or (at |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
8 ## your option) any later version. |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
9 ## |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
10 ## Octave is distributed in the hope that it will be useful, but |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
13 ## General Public License for more details. |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
14 ## |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
15 ## You should have received a copy of the GNU General Public License |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
16 ## along with Octave; see the file COPYING. If not, see |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
17 ## <http://www.gnu.org/licenses/>. |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
18 |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
19 ## -*- texinfo -*- |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
20 ## @deftypefn {Function File} {} isaxes (@var{h}) |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
21 ## Return true if @var{h} is an axes graphics handle and false otherwise. |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
22 ## |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
23 ## If @var{h} is a matrix then return a logical array which is true where |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
24 ## the elements of @var{h} are axes graphics handles and false where |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
25 ## they are not. |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
26 ## @seealso{isaxes, ishandle} |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
27 ## @end deftypefn |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
28 |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
29 ## Author: jwe |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
30 |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
31 function retval = isaxes (h) |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
32 |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
33 if (nargin != 1) |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
34 print_usage (); |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
35 endif |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
36 |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
37 hlist = ishandle (h); |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
38 if (any (hlist)) |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
39 retval(hlist) = strcmp (get (h(hlist), "type"), "axes"); |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
40 else |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
41 retval = hlist; |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
42 endif |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
43 |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
44 endfunction |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
45 |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
46 |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
47 %!test |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
48 %! hf = figure ("visible", "off"); |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
49 %! unwind_protect |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
50 %! hax = axes (); |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
51 %! assert (isaxes (hax)); |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
52 %! assert (! isaxes (-hax)); |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
53 %! unwind_protect_cleanup |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
54 %! close (hf); |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
55 %! end_unwind_protect |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
56 |