This is machine translation

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


Information about variable


[varname,xtype,dimids,natts] = netcdf.inqVar(ncid,varid)


[varname,xtype,dimids,natts] = netcdf.inqVar(ncid,varid) returns information about the variable identified by varid. The argument, ncid, is a netCDF file identifier returned by netcdf.create or

The output argument, varname, is the name of the variable. xtype is the data type, dimids is the dimension IDs, and natts is the number of attributes associated with the variable. Dimension IDs are zero-based.

This function corresponds to the nc_inq_var function in the netCDF library C API. Because MATLAB® uses FORTRAN-style ordering, however, the order of the dimension IDs is reversed relative to what would be obtained from the C API. To use this function, you should be familiar with the netCDF programming paradigm. See netcdf for more information.


Open the example netCDF file included with MATLAB,, and get information about a variable in the file.

% Open the example netCDF file.
ncid ='','NC_NOWRITE');

% Get information about third variable in the file.
[varname, xtype, dimids, numatts] = netcdf.inqVar(ncid,2)

varname =


xtype =


dimids =

     0     1

numatts =

     1     1
Was this topic helpful?