Skip to Main Content Skip to Search
Product Documentation

cdflib.renameAttr - Rename existing attribute

Syntax

cdflib.renameAttr(cdfId,attrNum,newName)

Description

cdflib.renameAttr(cdfId,attrNum,newName) renames an attribute in a Common Data Format (CDF) file.

cdfId identifies the CDF file. attrNum is a numeric value that identifies the attribute. Attribute numbers are zero-based. newName is a text string that specifies the name you want to assign to the attribute.

Examples

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

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

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

% Rename the attribute
cdflib.renameAttr(cdfid, attrNum, 'NewPurpose');

% Check the name of the attribute
attrName = cdflib.getAttrName(cdfid,anum)

attrName =

NewPurpose

% Clean up
cdflib.delete(cdfid);

clear cdfid

References

This function corresponds to the CDF library C API routine CDFrenameAttr. To use these functions, you must be familiar with the CDF C interface. Read the CDF documentation at the CDF Web site. For copyright information, see the cdfcopyright.txt file.

See Also

cdflib.createAttr

Tutorials

  


Free MATLAB Interactive Kit

Explore how to use MATLAB to make advancements in engineering and science.


Download free kit

Trials Available

Try the latest version of MATLAB and other MathWorks products.


Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS