Main Content

cdflib.getVarNum

Variable number, given variable name

Syntax

varNum = cdflib.getVarNum(cdfId,varname)

Description

varNum = cdflib.getVarNum(cdfId,varname) returns the identifier (variable number) for a variable in a Common Data Format (CDF) file.

cdfId identifies the CDF file. varname is a character vector or string scalar that identifies the variable. Variable names are case-sensitive.

Examples

Open example CDF, and then get the number of a variable named Longitude:

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

varNum = cdflib.getVarNum(cdfId,"Longitude")
varNum =

     1
% Clean up
cdflib.close(cdfId)
clear cdfId

References

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

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