changeset 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 105c72254967
children 027a2186cd90
files scripts/miscellaneous/getappdata.m
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
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)