netcdf.inqVar
Information about netCDF variable
Syntax
[varname,xtype,dimids,natts] = netcdf.inqVar(ncid,varid)
Description
[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 netcdf.open.
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.
Examples
Open the example netCDF file included with MATLAB, example.nc,
and get 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