cdflib.putAttrEntry
将值写入具有可变范围的属性中的条目
语法
cdflib.putAttrEntry(cdfId,attrNum,entryNum,CDFDataType,entryVal)
说明
cdflib.putAttrEntry(cdfId,attrNum,entryNum,CDFDataType,entryVal)
将值写入常用数据格式 (CDF) 文件中的属性条目。
输入参数
|
CDF 文件的标识符,通过调用 | ||||||||||||||||||||||||||||||||
|
数值,用于标识属性。该属性必须具有可变的范围。属性编号从 0 开始。 | ||||||||||||||||||||||||||||||||
|
数值,用于标识条目。条目编号从 0 开始。 | ||||||||||||||||||||||||||||||||
|
属性条目的数据类型,指定为以下字符向量或字符串标量之一或其等效数值。
| ||||||||||||||||||||||||||||||||
|
要写入属性条目的数据。 |
示例
创建一个 CDF 文件并在该文件中创建一个具有可变范围的属性。将值写入属性中的条目。要运行此示例,当前必须位于可写文件夹中。
cdfId = cdflib.create("your_file.cdf"); % Initially, the file contains no global or variable attributes info = cdflib.inquire(cdfId)
info = struct with fields: encoding: 'IBMPC_ENCODING' majority: 'ROW_MAJOR' maxRec: -1 numVars: 0 numvAttrs: 0 numgAttrs: 0
% Create an attribute of variable scope in the file attrNum = cdflib.createAttr(cdfId,"Another Attribute","variable_scope"); % Write a value to an entry for the attribute cdflib.putAttrEntry(cdfId,attrNum,0,"CDF_CHAR",... "My Variable Attribute Test") % Get the value of the global attribute entry value = cdflib.getAttrEntry(cdfId,attrNum,0)
value = 'My Variable Attribute Test'
% Clean up cdflib.delete(cdfId) clear cdfId