This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Return netCDF dimension name and length


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


[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

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. See netcdf for more information.


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

ncid ='','NC_NOWRITE');

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

dimname =


dimlen =

Was this topic helpful?