file in matlab code
Show older comments
Hello, I have an issue in my code to read .netcdf files I try to read it with
temp=ncread('/home/yves/Documents/pre/argo09_14/aoml/1901006/1901006_prof.nc','TEMP');
It works But when I try to create the file first to make it easier to change the file, it doesn't work
rootdir='/home/yves/Documents/pre/argo09_14/aoml/1901006/'
list=dir(rootdir)
a=char(list.name);
filename=(a(5,:))
file = [rootdir, num2str(filename)];
The file created is
/home/yves/Documents/pre/argo09_14/aoml/1901006/1901006_prof.nc
but
temp=ncread(file,'TEMP');
Gets me an error message:
Error using internal.matlab.imagesci.nc/openToRead (line 1252)
Could not open /home/yves/Documents/pre/argo09_14/aoml/1901006/1901006_prof.nc for
reading.
Error in internal.matlab.imagesci.nc (line 122)
this.openToRead();
Error in ncread (line 54)
ncObj = internal.matlab.imagesci.nc(ncFile);
Does anybody know what is wrong with the code? Thank's a lot for the help! Yves
Accepted Answer
More Answers (0)
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!