diff --git a/matlab/CHDF/cdf2mat.m b/matlab/CHDF/cdf2mat.m index 1deaca82ae9deb39412a67dc5dfe9945cdbf1e98..da2dac5299d66fe5802c7cce85d836543ae7098f 100644 --- a/matlab/CHDF/cdf2mat.m +++ b/matlab/CHDF/cdf2mat.m @@ -61,6 +61,7 @@ for i=1:length(coordnames_sorted) for ij=1:length(fields_variables_to_copy) matcdf.coords(i).(fields_variables_to_copy{ij}) = allinfo.Variables(matcdf.coords(i).index_allvarnames).(fields_variables_to_copy{ij}); end + % define defaults before fetching the values in Attributes (if provided) matcdf.coords(i).units = ''; matcdf.coords(i).long_name = [matcdf.coords(i).name ' empty']; for jj=1:numel(allinfo.Variables(matcdf.coords(i).index_allvarnames).Attributes) @@ -97,6 +98,7 @@ for i=1:length(varnames_sorted) for ij=1:length(fields_variables_to_copy) matcdf.vars(i).(fields_variables_to_copy{ij}) = allinfo.Variables(matcdf.vars(i).index_allvarnames).(fields_variables_to_copy{ij}); end + % define defaults before fetching the values in Attributes (if provided) matcdf.vars(i).units = ''; matcdf.vars(i).long_name = [matcdf.vars(i).name ' empty']; for jj=1:numel(allinfo.Variables(matcdf.vars(i).index_allvarnames).Attributes)