cdflib.renameAttr
重命名现有属性
语法
cdflib.renameAttr(cdfId,attrNum,newName)
说明
cdflib.renameAttr(cdfId,attrNum,newName)
对常用数据格式 (CDF) 文件中的属性进行重命名。
cdfId
标识 CDF 文件。attrNum
是标识属性的数值。属性编号从 0 开始。newName
是指定要分配给属性的名称的字符向量或字符串标量。
示例
创建一个 CDF 文件,并在该 CDF 文件中创建一个属性,然后对该属性进行重命名。要运行此示例,当前必须位于可写文件夹中。
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