Mercurial > hg > octave-lyh
changeset 17095:60228ef13f20
isfigure.m: Expand to allow matrix inputs and return a logical array.
* scripts/plot/isfigure.m: Expand to allow matrix inputs and return a logical
array.
author | Rik <rik@octave.org> |
---|---|
date | Thu, 25 Jul 2013 16:18:10 -0700 |
parents | e5ded64def41 |
children | 255d9e7aa494 e38820d1124c |
files | scripts/plot/isfigure.m |
diffstat | 1 files changed, 13 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/plot/isfigure.m +++ b/scripts/plot/isfigure.m @@ -18,8 +18,11 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} isfigure (@var{h}) -## Return true if @var{h} is a graphics handle that contains a figure -## object. +## Return true if @var{h} is a figure graphics handle and false otherwise. +## +## If @var{h} is a matrix then return a logical array which is true where +## the elements of @var{h} are figure graphics handles and false where +## they are not. ## @seealso{ishandle} ## @end deftypefn @@ -27,10 +30,15 @@ function retval = isfigure (h) - if (nargin == 1) - retval = (ishandle (h) && strcmp (get (h, "type"), "figure")); + if (nargin != 1) + print_usage (); + endif + + hlist = ishandle (h); + if (any (hlist)) + retval(hlist) = strcmp (get (h(hlist), "type"), "figure"); else - print_usage (); + retval = hlist; endif endfunction