ncread error could not open to read

53 views (last 30 days)
Chris on 12 Apr 2017
Answered: Nirav Sharda on 17 Apr 2017
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 (line 1259)
Could not open /sw-test-1-1-141-r28/ for reading.
Error in (line 121)
Error in ncread (line 53)
ncObj =;

Answers (1)

Nirav Sharda
Nirav Sharda on 17 Apr 2017
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 file in a folder called 'ncfile', my command would look like 'ncread('ncfile/',varname)'. I hope this helps.



Community Treasure Hunt

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

Start Hunting!

Translated by