Error "Could not open file 'ncfiles'". when using a for loop to open ncfiles
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Jonas Damsbo
am 3 Dez. 2018
Kommentiert: Walter Roberson
am 7 Dez. 2018
Hi
I have 469 ncfiles and I open them in a loop:
ncfiles = dir('*.nc') ;
Nfiles = length(ncfiles) ;
for i = 1:Nfiles;
ncdisp(ncfiles(i).name) ;
ncid=netcdf.open('ncfiles','NOWRITE');
varname = netcdf.inqVar(ncid);
[ndim, nvar, natt, unlim]=netcdf.inq(ncid);
end
But when I run the code I got the error when I used ncid:
Error using netcdf.open (line 52)
Could not open file 'ncfiles'.
Error in Blocking (line 9)
ncid=netcdf.open('ncfiles','NOWRITE');
I hope you can help me!
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 3 Dez. 2018
your file name is stored in ncfiles(i).name rather than being the literal file name 'ncfiles'
9 Kommentare
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!