file in matlab code
显示 更早的评论
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
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!