Cannot display/open NetCDF files - Please help!

20 ビュー (過去 30 日間)
ahamahoru
ahamahoru 2020 年 3 月 17 日
コメント済み: Walter Roberson 2020 年 3 月 17 日
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!

採用された回答

Walter Roberson
Walter Roberson 2020 年 3 月 17 日
ncfile = fullfile(folder, liste(i).name);
  2 件のコメント
ahamahoru
ahamahoru 2020 年 3 月 17 日
It works! Thank you so much!
But what is happening here, why suddenly the previous script stops working after i changed the directory?
Walter Roberson
Walter Roberson 2020 年 3 月 17 日
In order for the code to work you would have to have been cd to the folder.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeNetCDF についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by