MATLAB: Cannot display/open NetCDF files – Please help!

netcdf

Hello,
Thank you very much for reading the question!
I have trouble reading my 31 nc files using ncdisp and netcdf.open. Here's my script:
folder='C:\xxx\';
liste=dir(folder);
for i=3:length(liste)
ncfile=liste(i).name;
% open nc
ncdisp(ncfile)
ncid=netcdf.open(ncfile);
end
It was working perfectly yesterday, but today it's not working for both ncdisp and netcdf.open after i switched directory folder to work on another m files. After i switched back to the right folder, the problem started. Here is the error message:
Error using internal.matlab.imagesci.nc/openToRead (line 1272)
Could not open 21413_20100615to20120713_qc.nc for reading.
% 21413_20100615to20120713_qc.nc is the first file i want to open
Error in internal.matlab.imagesci.nc (line 121)
this.openToRead();
Error in ncdisp (line 62)
ncObj = internal.matlab.imagesci.nc(ncFile);
If i turn off the ncdisp and run the netcdf.open, here is the error message:
Error using netcdf.open (line 52)
Could not open file '21413_20100615to20120713_qc.nc'.
Could someone please help me on this? I know it's not about the data because i redownload the same data and it's still stuck. My best shot will be redownloading the netcdf pack again, but i would really like to know the reason behind this. I am using matlab R2019b.
Thank you so much for your help!

Best Answer

ncfile = fullfile(folder, liste(i).name);