From dc94b0e805b9d835bbc15f6386e15923e7809c1e Mon Sep 17 00:00:00 2001
From: Antoine Merle <antoine.merle@epfl.ch>
Date: Tue, 11 Feb 2025 09:36:18 +0000
Subject: [PATCH] More compact solution

---
 matlab/CHDF/cdf2mat.m | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/matlab/CHDF/cdf2mat.m b/matlab/CHDF/cdf2mat.m
index da2dac52..f2c1155b 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};
-- 
GitLab