Main Content

cdflib.inquireVar

Information about variable

Syntax

info = cdflib.inquireVar(cdfId,varNum)

Description

info = cdflib.inquireVar(cdfId,varNum) returns information about a variable in a Common Data Format (CDF) file.

Input Arguments

cdfId

Identifier of a CDF file, returned by a call to cdflib.create or cdflib.open.

varNum

Numeric value that identifies the variable. Variable numbers are zero-based.

Output Arguments

info

Structure containing the following fields.

FieldDescription
nameName of the variable
datatypeData type
numElementsNumber of elements of the datatype
dimsSizes of the dimensions
recVarianceRecord variance
dimVarianceDimension variances

Record and dimension variances affect how the library physically stores variable data. For example, if a variable has a record variance of VARY, the library physically stores each record. If the record variance is NOVARY, the library only stores one record.

Examples

Open the example CDF file and get information about a variable.

cdfId = cdflib.open("example.cdf");

% Determine if the file contains variables 
info  = cdflib.inquireVar(cdfId,1)
info = 

  struct with fields:

           name: 'Longitude'
       datatype: 'cdf_int1'
    numElements: 1
           dims: [2 2]
    recVariance: 0
    dimVariance: [1 0]
%Clean up
cdflib.close(cdfId)
clear cdfId

References

This function corresponds to the CDF library C API routine CDFinquirezVar.

To use this function, you must be familiar with the CDF C interface. You can access the CDF documentation at the CDF website.