Main Content

netcdf.inqDim

Return netCDF dimension name and length

Syntax

[dimname, dimlen] = netcdf.inqDim(ncid,dimid)

Description

[dimname, dimlen] = netcdf.inqDim(ncid,dimid) returns the name, dimname, and length, dimlen, of the dimension specified by dimid. If ndims is the number of dimensions defined for a netCDF file, each dimension has an ID between 0 and ndims-1. For example, the dimension identifier of the first dimension is 0, the second dimension is 1, and so on.

ncid is a netCDF file identifier returned by netcdf.create or netcdf.open.

This function corresponds to the nc_inq_dim function in the netCDF library C API. To use this function, you should be familiar with the netCDF programming paradigm.

Examples

The example opens the example netCDF file include with MATLAB®, example.nc.

ncid = netcdf.open('example.nc','NC_NOWRITE');

% Get name and length of first dimension
[dimname, dimlen] = netcdf.inqDim(ncid,0)

dimname =

x


dimlen =

    50