I have several files of different name such as SOx_AGRICULTURE_1x1km.nc or PM2.5_TRAN​SPORT_1x1k​m.nc. I have 40 files, my question is if I can open them as a "for" loop in matlab? In advance thank you very much for your response.

1 view (last 30 days)
I have several files of different name such as SOx_AGRICULTURE_1x1km.nc or PM2.5_TRANSPORT_1x1km.nc. I have 40 files, my question is if I can open them as a "for" loop in matlab?
In advance thank you very much for your response.
Best regards

Accepted Answer

KSSV
KSSV on 15 Jun 2016
Yes you can open them in a for loop.
ncfiles = dir('*.nc') ; % you are in the folder of nc files
%
Nfiles = length(ncfiles) ; % Total number of nc files
for i = 1:Nfiles % loop for each file
%%ncread
%%do what ever you want
end

More Answers (0)

Categories

Find more on Agriculture 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!