Main Content

matlab.io.hdfeos.sw.writeAttr

Namespace: matlab.io.hdfeos.sw

Write swath attribute

Syntax

writeAttr(swathID,attrname,data)

Description

writeAttr(swathID,attrname,data) writes an attribute to a swath. If the attribute does not exist, it is created. If the attribute exists, it can be modified in place, but it cannot be recreated with a different data type or length.

This function corresponds to the SWwriteattr function in the HDF-EOS library C API.

Examples

import matlab.io.hdfeos.*
swfid = sw.open('myfile.hdf','create');
swathID = sw.create(swfid,'MySwath');
sw.writeAttr(swathID,'creation_date', datestr(now));
sw.detach(swathID);
sw.close(swfid);

See Also