how to create a STRUCTURE composed of variables from .NC files

3 ビュー (過去 30 日間)
ELISABETTA BILLOTTA
ELISABETTA BILLOTTA 2022 年 7 月 6 日
コメント済み: Walter Roberson 2022 年 7 月 10 日
I have a very heavy set of .NC files (ERA 5 from Copernicus) to use within other scripts. They are the data relating to the characteristics of the winds.
I would therefore like to divide the .NC files into a STRUCTURE composed of all the variables present within the files, so that I can insert that structure within the other scripts and not re-read the.NC files from scratch, but taking into consideration directly the variable that interests me within the structure.
the variables are lat, long, altitude, time, z, u, v.
Can anyone help me?
  2 件のコメント
ELISABETTA BILLOTTA
ELISABETTA BILLOTTA 2022 年 7 月 6 日
because it was suggested to me to make other scripts run faster

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

回答 (1 件)

Walter Roberson
Walter Roberson 2022 年 7 月 6 日
source = 'something appropriate';
vars = ["lat", "long", "altitude", "time", "z", "u", "v"];
for var = vars
HeavyStruct.(var) = ncread(source, var);
end
  6 件のコメント
Walter Roberson
Walter Roberson 2022 年 7 月 10 日
Earlier, when you gave the names of the variables, none of the names ended in "90", but you then changed so that they all end in "90". What does ncinfo say that the variable names are?

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

カテゴリ

Find more on Coordinate Reference Systems 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!

Translated by