Main Content


Number of entries for attribute with variable scope


nentries = cdflib.getNumAttrEntries(cdfId,attrNum)


nentries = cdflib.getNumAttrEntries(cdfId,attrNum) returns the number of entries for the specified attribute in the Common Data Format (CDF) file.

cdfId identifies the CDF file.

attrNum is a numeric value that specifies the attribute. Attribute numbers are zero-based. The attribute must have variable scope.


Open the example CDF, find an attribute with variable scope, and determine how many entries are associated with the attribute:

cdfId ="example.cdf");

% Get the number of an attribute with variable scope
attrNum = cdflib.getAttrNum(cdfId,"Description");

% Check that scope of attribute is variable
attrScope = cdflib.getAttrScope(cdfId,attrNum)
attrScope =

% Determine the number of entries for the attribute
attrEntries = cdflib.getNumAttrEntries(cdfId,attrNum)
attrEntries =

% Clean up
clear cdfId


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

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