Hi Ana,
I understand that you want to read the variables backward. I see that there is some problem with naming of the variables.
for k = length(fileList):-1:1
k is an integer here, which is causing problems in,
for s = length(k):-1:1
if isempty(k)
continue;
else
baseFileName = k(s).name;
fullFileName = fullfile(myFolder, baseFileName);
ncfile = [myFolder k(s).name];
end
end
In this loop, there are multiple references to variable k. This should be s{k} instead.
Hope this helps.
2 Comments
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/592171-reading-netcdf-files-and-variables-backwards#comment_1005199
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/592171-reading-netcdf-files-and-variables-backwards#comment_1005199
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/592171-reading-netcdf-files-and-variables-backwards#comment_1009588
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/592171-reading-netcdf-files-and-variables-backwards#comment_1009588
Sign in to comment.