Skip to content

Commit

Permalink
Attributes in the output NetCDF files are now listed in alphabetical …
Browse files Browse the repository at this point in the history
…order for ease of read by humans.
  • Loading branch information
ggalibert committed Nov 10, 2016
1 parent 438b06a commit d97b6ba
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion NetCDF/exportNetCDF.m
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
if ~ischar(dest), error('dest must be a string'); end

% check that destination is a directory
[stat atts] = fileattrib(dest);
[stat, atts] = fileattrib(dest);
if ~stat || ~atts.directory || ~atts.UserWrite
error([dest ' does not exist, is not a directory, or is not writeable']);
end
Expand Down Expand Up @@ -644,6 +644,10 @@ function putAtts(fid, vid, var, template, templateFile, netcdfType, dateFmt, mod

% each att is a struct field
atts = fieldnames(template);

% let's process them in the alphabetical order regardless of the case
[~, iSort] = sort(lower(atts));
atts = atts(iSort);
for k = 1:length(atts)

name = atts{k};
Expand Down

0 comments on commit d97b6ba

Please sign in to comment.