ncread error could not open to read

I get the following error while trying to access the nc file. If i get into the folder and try it directly ncread works, but I need to use it in a for loop for a number of similar folders. Any ideas why I get this error?
Error using internal.matlab.imagesci.nc/openToRead (line 1259)
Could not open /sw-test-1-1-141-r28/cpd.nc for reading.
Error in internal.matlab.imagesci.nc (line 121)
this.openToRead();
Error in ncread (line 53)
ncObj = internal.matlab.imagesci.nc(ncFile);

回答 (2 件)

Nirav Sharda
Nirav Sharda 2017 年 4 月 17 日

1 投票

I was able to get the same error message. Try to remove the first '/' from the filename passed as input argument to the 'ncread' function. If I have a demo.nc file in a folder called 'ncfile', my command would look like 'ncread('ncfile/demo.nc',varname)'. I hope this helps.
허
44分 前

0 投票

다음 사용 중 오류가 발생함: internal.matlab.imagesci.nc/openToRead (1299번 라인)
파일 "C:\Users\MSG\Desktop\jnu_matlab\2017_hycom\GOFS\2017\Monthly\2017\Monthly\HYCOM_201702.nc"을(를) 열 수 없습니다.
오류 발생: internal.matlab.imagesci.nc (124번 라인)
this.openToRead();
오류 발생: ncread (71번 라인)
ncObj = internal.matlab.imagesci.nc(ncFile); 혹시 여기서 다음과 같은 오류가 나오는 이유가 무엇일지 알 수 있는가

2 件のコメント

Walter Roberson
Walter Roberson 6分 前
Approximate translation:
Error occurred while using internal.matlab.imagesci.nc/openToRead (line 1299)
Cannot open file "C:\Users\MSG\Desktop\jnu_matlab\2017_hycom\GOFS\2017\Monthly\2017\Monthly\HYCOM_201702.nc".
Error occurred:
internal.matlab.imagesci.nc (line 124) this.openToRead();
Error occurred:
ncread (line 71) ncObj = internal.matlab.imagesci.nc(ncFile);
Do you happen to know why the following error is appearing here?
Walter Roberson
Walter Roberson 5分 前
Does C:\Users\MSG\Desktop\jnu_matlab\2017_hycom\GOFS\2017\Monthly\2017\Monthly\HYCOM_201702.nc exist?

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

カテゴリ

ヘルプ センター および File ExchangeMATLAB についてさらに検索

製品

タグ

質問済み:

2017 年 4 月 12 日

Community Treasure Hunt

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

Start Hunting!

Translated by