diff --git a/matlab/CHDF/cdf2mat.m b/matlab/CHDF/cdf2mat.m
index da2dac5299d66fe5802c7cce85d836543ae7098f..f2c1155bd9ac11239d13c77fc09e08f60c2a946f 100644
--- a/matlab/CHDF/cdf2mat.m
+++ b/matlab/CHDF/cdf2mat.m
@@ -138,15 +138,11 @@ end
 if ~isempty(allinfo.Attributes)
   top_attr_names = {allinfo.Attributes(:).Name};
   ij = strmatch('shot',top_attr_names,'exact');
-  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
+  ij = [];
+end
+if ~isempty(ij)
+  cdf2mat_out.shot = allinfo.Attributes(ij).Value;
 else
   if nargin>1 && isnumeric(varargin{1})
     cdf2mat_out.shot = varargin{1};