Main Content

netcdf.inqVarIDs

Return IDs of all variables in group

    Description

    varids = netcdf.inqVarIDs(ncid) returns the IDs of all the variables in the file or group specified by ncid.

    example

    Examples

    collapse all

    Open the sample netCDF file, and get the IDs of all the variables in a group. In this case, the specified group contains one variable with an ID of 0.

    ncid = netcdf.open("example.nc","NOWRITE");
    gid = netcdf.inqNcid(ncid,"grid1");
    varids = netcdf.inqVarIDs(gid)
    
    varids =
    
         0
    

    Close the netCDF file.

    netcdf.close(ncid)
    

    Input Arguments

    collapse all

    NetCDF file or group identifier, specified as a nonnegative integer scalar. You can use the netcdf.create or netcdf.open function to return a file identifier. You can use the netcdf.defGrp function to return a group identifier.

    Data Types: double

    Tips

    • This function corresponds to the nc_inq_varids function in the netCDF library C API.

    Version History

    Introduced in R2010b