i have total 364 number of .nc files and i want to read only 10 .nc files with lat,lon,time,and soilmoisture.

1 回表示 (過去 30 日間)
Jincy
Jincy 2023 年 5 月 30 日
編集済み: Mathieu NOE 2023 年 5 月 31 日
In this data lat,lon,time and soil moisture are the variables and they all are same for this 10 files except soil moisture data. It is different in each files. When i use this code the the 10 files are not reading together.
path = home to file folder
file_num = 10;
files = dir('10*.nc')
for i = 1:length(file_num)
sm(i) = ncread(i,'sm')
end
  1 件のコメント
Mathieu NOE
Mathieu NOE 2023 年 5 月 31 日
編集済み: Mathieu NOE 2023 年 5 月 31 日
your for loop is wrong
for i = 1:file_num
sm(i) = ncread(files(i).name,'sm')
end

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeAgriculture についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by