cdflib.deleteAttrEntry
从具有变量作用域的属性中删除条目
语法
cdflib.deleteAttrEntry(cdfId,attrNum,entryNum)
说明
cdflib.deleteAttrEntry(cdfId,attrNum,entryNum) 删除常用数据格式 (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 with variable scope in the file attrNum = cdflib.createAttr(cdfId,"myVarScopeAttr","variable_scope"); % Write a value to an entry for the attribute cdflib.putAttrEntry(cdfId,attrNum,0,"CDF_CHAR","My attr value") % Get the value of the attribute entry value = cdflib.getAttrEntry(cdfId,attrNum,0)
value =
'My attr value'% Delete the entry cdflib.deleteAttrEntry(cdfId,attrNum,0) % Now try to view the value of the entry try value = cdflib.getAttrEntry(cdfId,attrNum,0); catch warning("No attribute associated with this variable") end
Warning: No attribute associated with this variable
% Clean up cdflib.delete(cdfId) clear cdfId
提示
此函数对应于 CDF 库的 C API 例程
CDFdeleteAttrzEntry。要使用此函数,必须熟悉 CDF C 接口。您可以在 CDF 网站上访问 CDF 文档。