Skip to Main Content Skip to Search
Product Documentation

netcdf.inqVar - Return information about variable

Syntax

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

Description

[varname,xtype,dimids,natts] = netcdf.inqVar(ncid,varid) returns the name, data type, dimensions IDs, and the number of attributes associated with the variable identified by varid. Dimension IDs are zero-based.

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

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.

Examples

This example opens the example netCDF file included with MATLAB, example.nc, and gets information about a variable in the file.

% Open the example netCDF file.
ncid = netcdf.open('example.nc','NC_NOWRITE');

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

varname =

peaks


xtype =

     5


dimids =

     0     1


numatts =

     1     1

See Also

netcdf.create | netcdf.inqVarID | netcdf.open

  


» Learn more
» Download free kit
» Get trial software

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS