Mercurial > hg > octave-lyh
diff scripts/miscellaneous/getappdata.m @ 13243:f9aec0bcf826
getappdata: return empty matrix for nonexistent property names
* getappdata.m: Always initialize missing fields to [], not just when
getting the __appdata__ property fails.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 28 Sep 2011 21:46:39 -0400 |
parents | bd2cd4fd3edf |
children | 72c96de7a403 |
line wrap: on
line diff
--- a/scripts/miscellaneous/getappdata.m +++ b/scripts/miscellaneous/getappdata.m @@ -36,9 +36,10 @@ for nh = 1:numel(h) try appdata = get (h(nh), "__appdata__"); - catch + end_try_catch + if (! isfield (appdata, name)) appdata.(name) = []; - end_try_catch + endif val(nh) = {appdata.(name)}; endfor if (nh == 1)