This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Create attribute


attrnum = cdflib.createAttr(cdfId,attrName,scope)


attrnum = cdflib.createAttr(cdfId,attrName,scope) creates an attribute in a CDF file with the specified scope.

Input Arguments


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


Text string that specifies the name you want to assign to the attribute.


One of the following text strings, or its numeric equivalent, that specifies the scope of the attribute.

Text StringDescription
'global_scope'Attribute applies to the CDF as a whole.
'variable_scope'Attribute applies only to the variable

To get the numeric equivalent of these text string constants, use the cdflib.getConstantValue function.

Output Arguments


Numeric value identifying the attribute. Attribute numbers are zero-based.


Create a CDF, and then create an attribute in the CDF. To run this example, you must be in a writable folder.

cdfid = cdflib.create('your_file.cdf');

% Create attribute
attrNum = cdflib.createAttr(cdfId,'Purpose','global_scope');

% Clean up

clear cdfid

Related Examples


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

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

For copyright information, see the cdfcopyright.txt file.

Was this topic helpful?