cdflib.putAttrEntry
Write value to entry in attribute with variable scope
Syntax
cdflib.putAttrEntry(cdfId,attrNum,entryNum,CDFDataType,entryVal)
Description
cdflib.putAttrEntry(cdfId,attrNum,entryNum,CDFDataType,entryVal)
writes a value to an attribute entry in a Common Data Format (CDF)
file.
Input Arguments
| Identifier of a CDF file, returned by a call to | ||||||||||||||||||||||||||||||||
| Number identifying attribute. The attribute must have variable scope. Attribute numbers are zero-based. | ||||||||||||||||||||||||||||||||
| Number identifying entry. Entry numbers are zero-based. | ||||||||||||||||||||||||||||||||
| Data type of the attribute entry, specified as one of the following character vectors or string scalars, or its numeric equivalent.
| ||||||||||||||||||||||||||||||||
| Data to be written to attribute entry. |
Examples
Create a CDF and create an attribute with variable scope in the file. Write a value to an entry in the attribute. To run this example, you must be in a writable folder.
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
Tips
This function corresponds to the CDF library C API routine
CDFputAttrzEntry.To use this function, you must be familiar with the CDF C interface. You can access the CDF documentation at the CDF website.