diff --git a/matlab/CHDF/cdf2mat.m b/matlab/CHDF/cdf2mat.m index 270ded91b2c3d17fed346692ccaf567eb9155e10..1deaca82ae9deb39412a67dc5dfe9945cdbf1e98 100644 --- a/matlab/CHDF/cdf2mat.m +++ b/matlab/CHDF/cdf2mat.m @@ -136,7 +136,15 @@ end if ~isempty(allinfo.Attributes) top_attr_names = {allinfo.Attributes(:).Name}; ij = strmatch('shot',top_attr_names,'exact'); - cdf2mat_out.shot = allinfo.Attributes(ij).Value; + if ~isempty(ij) + cdf2mat_out.shot = allinfo.Attributes(ij).Value; + else + if nargin>1 && isnumeric(varargin{1}) + cdf2mat_out.shot = varargin{1}; + else + cdf2mat_out.shot = NaN; + end + end else if nargin>1 && isnumeric(varargin{1}) cdf2mat_out.shot = varargin{1};