Create variables inside the field of netcdf

3 ビュー (過去 30 日間)
Ahmet Hakan UYANIK
Ahmet Hakan UYANIK 2022 年 7 月 20 日
回答済み: MJFcoNaN 2022 年 7 月 20 日
Hi,
I am trying to create a netcdf with the variables I am having in matrix form. However, I cannot create a variable inside a field.
fid=netcdf.create([outputpath '.nc'],'NETCDF4');
latdimID = netcdf.defDim(fid,'lat',length(lat));
lat_ID = netcdf.defVar(fid,'lat','double',latdimID);
netcdf.endDef(fid);
netcdf.putVar(fid,lat_ID, latvalues);
like this way of working, I am able to create a variable but I want my variable to be inside the field of "Europe" for example.
so in the end, I intend to something like this:
lat_ID = netcdf.defVar(fid,'Europe/lat','double',latdimID);
but of course, it is not correct way to proceed. Do you know how can I put all of my variables inside one field? with the help of this, I can classify my variables.
Thanks

採用された回答

MJFcoNaN
MJFcoNaN 2022 年 7 月 20 日
Hello,
"Europe" will be a group name in netcdf:
GID = netcdf.defGrp(fid,'Europe');
lat_ID = netcdf.defVar(GID,'lat','double',latdimID);

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by