| Contents | Index |
cdflib.putAttrgEntry(cdfId,attrNum,entryNum,cdfDataType,entryVal)
cdflib.putAttrgEntry(cdfId,attrNum,entryNum,cdfDataType,entryVal) writes a value to a global attribute entry in a Common Data Format (CDF) file.
Create a CDF and create a global attribute 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 attributes, global or variable.
info = cdflib.inquire(cdfid)
info =
encoding: 'IBMPC_ENCODING'
majority: 'ROW_MAJOR'
maxRec: -1
numVars: 0
numvAttrs: 0
numgAttrs: 0
% Create a global attribute in the file.
attrNum = cdflib.createAttr(cdfid,'Purpose','global_scope');
% Write a value to an entry for the global attribute
cdflib.putAttrgEntry(cdfid,attrNum,0,'CDF_CHAR','My Test');
% Get the value of the global attribute entry
value = cdflib.getAttrgEntry(cdfid,attrNum,0)
value =
My Test
% Clean up
cdflib.delete(cdfid);
clear cdfidThis function corresponds to the CDF library C API routine CDFputAttrgEntry. To use these functions, you must be familiar with the CDF C interface. Read the CDF documentation at the CDF Web site. For copyright information, see the cdfcopyright.txt file.
cdflib.getAttrEntry | cdflib.getAttrgEntry | cdflib.getConstantValue | cdflib.putAttrEntry

Explore how to use MATLAB to make advancements in engineering and science.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |