diff --git a/@tsg_nc/get_fieldnames.m b/@tsg_nc/get_fieldnames.m index 0349aabd65f45bae40f04ddb27079891bb744149..64ed143c04695228cca2c84e1491f4d7509c0fac 100644 --- a/@tsg_nc/get_fieldnames.m +++ b/@tsg_nc/get_fieldnames.m @@ -1,10 +1,10 @@ function result = get_fieldnames( self ) -% tsg_ncvar/get_fieldnames -- get internal fieldnames of "tsg_ncvar" object. +% tsg_nc/get_fieldnames -- get internal structure fieldnames of "tsg_nc" object. % % Input % ----- -% self ........... an instance of 'tsg_ncvar' object +% self ........... an instance of 'tsg_nc' object % % Output % ------ @@ -12,7 +12,14 @@ function result = get_fieldnames( self ) % $Id$ -theStruc = get(self,'DAYD'); -result = fieldnames(theStruc); - +% get cell of keys inside object +% ------------------------------ +c = get(self); +if isempty(c) + warning('Empty object') ; +else + % get structure for the first element + theStruc = get(self,c{1}); + result = fieldnames(theStruc); +end