Main Content


Return ID of parent group



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


    collapse all

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

    ncid ="",'NOWRITE');
    gid = netcdf.inqNcid(ncid,"grid2");
    parentId = netcdf.inqGrpParent(gid);
    fullName = netcdf.inqGrpNameFull(parentId);

    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

    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