Main Content


Create group in netCDF file



childGrpID = netcdf.defGrp(parentGroupId,childGroupName) creates a child group with the name specified by childGroupName, that is the child of the parent group specified by parentGroupId.


This function corresponds to the nc_def_grp function in the netCDF library C API.


collapse all

This example creates a netCDF dataset and then defines a group.

ncid = netcdf.create("","netcdf4");
childGroupId = netcdf.defGrp(ncid,"mygroup");

Input Arguments

collapse all

Identifier of netCDF file, returned by netcdf.create function or function, or of a netCDF group, returned by netcdf.defGrp function.

Data Types: double

Child group name that you want to assign, specified as a string scalar or a character vector.

Data Types: string | char

Output Arguments

collapse all

Identifier of a netCDF group, returned as an integer.

Data Types: double

Version History

Introduced in R2010b