Mercurial > hg > octave-nkf
annotate scripts/plot/util/isaxes.m @ 19069:afab3a2f57e7
doc: Update docstring for exist().
* variables.cc (Fexist): Update documentation string.
author | Rik <rik@octave.org> |
---|---|
date | Sun, 29 Jun 2014 12:58:22 -0700 |
parents | 4ca40b289b2c |
children | 4197fc428c7d |
rev | line source |
---|---|
17123
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); |
18936
4ca40b289b2c
isaxes.m: Fix bug where some inputs do not show up in outputs (bug #42362).
Stefan Mahr <dac922@gmx.de>
parents:
17572
diff
changeset
|
38 retval = hlist; |
4ca40b289b2c
isaxes.m: Fix bug where some inputs do not show up in outputs (bug #42362).
Stefan Mahr <dac922@gmx.de>
parents:
17572
diff
changeset
|
39 |
17123
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
40 if (any (hlist)) |
bcada0a4f8a7
isaxes.m: New function to determine if object is axes handle.
Rik <rik@octave.org>
parents:
diff
changeset
|
41 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
|
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 |
18936
4ca40b289b2c
isaxes.m: Fix bug where some inputs do not show up in outputs (bug #42362).
Stefan Mahr <dac922@gmx.de>
parents:
17572
diff
changeset
|
57 %!test |
4ca40b289b2c
isaxes.m: Fix bug where some inputs do not show up in outputs (bug #42362).
Stefan Mahr <dac922@gmx.de>
parents:
17572
diff
changeset
|
58 %! hf = figure ("visible", "off"); |
4ca40b289b2c
isaxes.m: Fix bug where some inputs do not show up in outputs (bug #42362).
Stefan Mahr <dac922@gmx.de>
parents:
17572
diff
changeset
|
59 %! unwind_protect |
4ca40b289b2c
isaxes.m: Fix bug where some inputs do not show up in outputs (bug #42362).
Stefan Mahr <dac922@gmx.de>
parents:
17572
diff
changeset
|
60 %! hax = axes (); |
4ca40b289b2c
isaxes.m: Fix bug where some inputs do not show up in outputs (bug #42362).
Stefan Mahr <dac922@gmx.de>
parents:
17572
diff
changeset
|
61 %! assert (isaxes ([hax NaN]), [true false]); |
4ca40b289b2c
isaxes.m: Fix bug where some inputs do not show up in outputs (bug #42362).
Stefan Mahr <dac922@gmx.de>
parents:
17572
diff
changeset
|
62 %! unwind_protect_cleanup |
4ca40b289b2c
isaxes.m: Fix bug where some inputs do not show up in outputs (bug #42362).
Stefan Mahr <dac922@gmx.de>
parents:
17572
diff
changeset
|
63 %! close (hf); |
4ca40b289b2c
isaxes.m: Fix bug where some inputs do not show up in outputs (bug #42362).
Stefan Mahr <dac922@gmx.de>
parents:
17572
diff
changeset
|
64 %! end_unwind_protect |