Main Content

netcdf.inqGrpParent

Retrieve ID of parent group

    Description

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

    Examples

    Retrieve Parent Group Path

    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);

    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

    Output Arguments

    collapse all

    Identifier of the NetCDF group or file that is the parent of the specified file or group, returned as an integer.

    Data Types: double

    Version History

    Introduced in R2010b