# HG changeset patch # User Rik # Date 1374794290 25200 # Node ID 60228ef13f20832221f63e87b3579ede332b39c7 # Parent e5ded64def41f1496a80f49b61f76192d64913d3 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. diff --git a/scripts/plot/isfigure.m b/scripts/plot/isfigure.m --- 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