cdflib.renameAttr
Change name of 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 character vector or string scalar 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"); % Check the name of the attribute attrName = cdflib.getAttrName(cdfId,attrNum)
attrName = 'Purpose'
% Rename the attribute cdflib.renameAttr(cdfId,attrNum,"NewPurpose") % Check the new name of the attribute attrName = cdflib.getAttrName(cdfId,attrNum)
attrName = 'NewPurpose'
% Clean up cdflib.delete(cdfId) clear cdfId
Tips
This function corresponds to the CDF library C API routine
CDFrenameAttr
.To use this function, you must be familiar with the CDF C interface. You can access the CDF documentation at the CDF website.