Mercurial > hg > octave-nkf
diff scripts/plot/isprop.m @ 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 | c792872f8942 |
children | 72c96de7a403 |
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)) +