Regarding reading diffrent files
조회 수: 1 (최근 30일)
이전 댓글 표시
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 ?
댓글 수: 0
답변 (1개)
Fangjun Jiang
2011년 9월 19일
Files=dir('*.nc');
for k=1:length(Files)
FileName=Files(k).name;
%load file
end
댓글 수: 7
Fangjun Jiang
2011년 9월 19일
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?
참고 항목
카테고리
Help Center 및 File Exchange에서 Text Files에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!