Borrar filtros
Borrar filtros

Regarding reading diffrent files

1 visualización (últimos 30 días)
Uday
Uday el 19 de Sept. de 2011
I have some .nc files for 13 years (13 files) e.g GTE_bb_CH_1997.nc,GTE_bb_CH_1998.nc,...., GTE_bb_CH_2009.nc I want to read and plot all files same time. So how I can write loop so I can read separate file for every year ?

Respuestas (1)

Fangjun Jiang
Fangjun Jiang el 19 de Sept. de 2011
Files=dir('*.nc');
for k=1:length(Files)
FileName=Files(k).name;
%load file
end
  7 comentarios
Uday
Uday el 19 de Sept. de 2011
its not over writing
dir_list=dir('*.nc');
for i=1:length(dir_list)
FileName=dir_list(i).name;
ncid=netcdf.open(FileName,'NOWRITE');
the above para does not read the data files those I have in that folder ( 13 different year files).
Sorry I just forgot to wrote end in the previous codes.
Fangjun Jiang
Fangjun Jiang el 19 de Sept. de 2011
Try this:
dir_list=dir('*.nc');
for i=1:length(dir_list)
FileName=dir_list(i).name
end
Do you see 13 file names appear in the Command Window?

Iniciar sesión para comentar.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by