Products & Services Solutions Academia Support User Community Company

Learn more about MATLAB   

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 information about netCDF contained in the NetCDF C Interface Guide for version 3.6.2.

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

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

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