changeset 13214:7715aca4bce1

Allow an nd-array of handles when calling isprop.m. * scripts/plot/isprop.m: Support non-scalar hangles. Add test.
author Ben Abbott <bpabbott@mac.com>
date Sun, 25 Sep 2011 11:55:39 -0400
parents 544304a09e42
children cb8fd692b600
files scripts/plot/isprop.m
diffstat 1 files changed, 12 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/plot/isprop.m
+++ b/scripts/plot/isprop.m
@@ -30,21 +30,26 @@
     print_usage ();
   endif
 
-  if (! ishandle (h))
+  if (! all (ishandle (h)))
     error ("isprop: first input argument must be a handle");
   elseif (! ischar (prop))
     error ("isprop: second input argument must be string");
   endif
 
-  res = true;
-  try
-    v = get (h, prop);
-  catch
-    res = false;
-  end_try_catch
+  res = false (size (h));
+  for n = 1:numel(res)
+    res(n) = true;
+    try
+      v = get (h(n), prop);
+    catch
+      res(n) = false;
+    end_try_catch
+  endfor
 endfunction
 
 %!assert (isprop (0, "foobar"), false)
 
 %!assert (isprop (0, "screenpixelsperinch"), true)
 
+%!assert (isprop (zeros (2, 3), "visible"), true (2, 3))
+