Package: matlab.io.hdfeos.gd
Write grid attribute
writeAttr(gridID,attrname,data)
writeAttr(gridID,attrname,data)
writes
an attribute to a grid. 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 GDwriteattr
function
in the HDF-EOS library C API.
import matlab.io.hdfeos.* srcFile = fullfile(matlabroot,'toolbox','matlab','imagesci','grid.hdf'); copyfile(srcFile,'myfile.hdf'); fileattrib('myfile.hdf','+w'); gfid = gd.open('myfile.hdf','rdwr'); gridID = gd.attach(gfid,'PolarGrid'); gd.writeAttr(gridID,'modification_date',datestr(now)); gd.detach(gridID); gd.close(gfid);