# HG changeset patch # User Ben Abbott # Date 1316966139 14400 # Node ID 7715aca4bce1ba871a765c735e1429e0102f8322 # Parent 544304a09e42200b1a989537508c8a7438fb1e45 Allow an nd-array of handles when calling isprop.m. * scripts/plot/isprop.m: Support non-scalar hangles. Add test. diff --git a/scripts/plot/isprop.m b/scripts/plot/isprop.m --- 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)) +