netcdf.inqGrpParent

Retrieve ID of parent group.

Syntax

parentGroupID = netcdf.inqGrpParent(ncid)

Description

parentGroupID = netcdf.inqGrpParent(ncid) returns the ID of the parent group given the location of the child group, specified by ncid.

Input Arguments

ncid

Identifier of a NetCDF file, returned by netcdf.create or netcdf.open, or of a NetCDF group, returned by netcdf.defGrp.

Output Arguments

parentGroupID

Identifier of the NetCDF group or file that is the parent of the specified file or group.

Examples

This example opens the NetCDF sample file and gets the full path of the parent of the specified group.

ncid = netcdf.open('example.nc','NOWRITE');
gid = netcdf.inqNcid(ncid,'grid2');
parentId = netcdf.inqGrpParent(gid);
fullName = netcdf.inqGrpNameFull(parentId);
netcdf.close(ncid);

References

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

For copyright information, read the netcdfcopyright.txt and mexnccopyright.txt files.