Main Content

netcdf.defGrp

Create group in NetCDF file

Description

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.

Note

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

Examples

Create NetCDF Dataset and Define Group

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

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

Input Arguments

collapse all

Identifier of NetCDF file, returned by netcdf.create function or netcdf.open 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