This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

H5A.write

Write attribute

Syntax

H5A.write(attr_id,type_id,buf)

Description

H5A.write(attr_id,type_id,buf) writes the data in buf into the attribute specified by attr_id. type_id specifies the attribute's memory datatype. The memory datatype should be 'H5ML_DEFAULT', which specifies that MATLAB® should determine the appropriate memory datatype.

Note

The HDF5 library uses C-style ordering for multidimensional arrays, while MATLAB uses FORTRAN-style ordering. If the MATLAB array size is 5-by-4-by-3, then the HDF5 library should be reporting the attribute size as 3-by-4-by-5. Please consult "Using the MATLAB Low-Level HDF5 Functions" in the MATLAB documentation for more information.

Examples

Write a scalar double precision attribute.

acpl = H5P.create('H5P_ATTRIBUTE_CREATE');
type_id = H5T.copy('H5T_NATIVE_DOUBLE');
space_id = H5S.create('H5S_SCALAR');
fid = H5F.create('myfile.h5');
attr_id = H5A.create(fid,'my_attr',type_id,space_id,acpl);
H5A.write(attr_id,'H5ML_DEFAULT',10.0)
H5A.close(attr_id);
H5F.close(fid);
H5T.close(type_id);

See Also