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
ncid, is a netCDF file identifier
The output argument,
varname, is the name
of the variable.
xtype is the data type,
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.
Open the example netCDF file included with MATLAB,
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