Main Content

netcdf.defGrp

在 NetCDF 文件中创建组

语法

childGrpID = netcdf.defGrp(parentGroupId,childGroupName)

说明

childGrpID = netcdf.defGrp(parentGroupId,childGroupName) 使用 childGroupName 中指定的名称创建一个子组,它是 parentGroupId 指定的父组的子组。

输入参数

parentGroupId

netcdf.createnetcdf.open 返回的 NetCDF 文件标识符,或者由 netcdf.defGrp 返回的 NetCDF 组标识符。

childGroupName

指定要为组分配的名称的字符向量或字符串标量。

输出参数

childGrpID

NetCDF 组的标识符。

示例

本例创建一个 NetCDF 数据集,然后定义一个组。

ncid = netcdf.create('myfile.nc','netcdf4');
childGroupId = netcdf.defGrp(ncid,'mygroup');
netcdf.close(ncid);

参考

此函数对应于 netCDF 库 C API 中的 nc_def_grp 函数。

另请参阅