h5readatt

Read attribute from HDF5 file

Syntax

attval = h5readatt(filename,loc,attr)

Description

attval = h5readatt(filename,loc,attr) retrieves the value of the specified attribute from the specified location in an HDF5 file.

Examples

collapse all

Read the attribute attr2 from the root group of the HDF5 file example.h5.

val = h5readatt('example.h5','/','attr2')
val = 2x2 int32 matrix

   0   2
   1   3

Read the attribute units from the dataset lon in the HDF5 file example.h5.

val = h5readatt('example.h5','/g4/lon','units')
val = 
'degrees_east'

Input Arguments

collapse all

File name, specified as a character vector or string scalar containing the name of an existing HDF5 file.

Location in the file, specified as a character vector or string scalar containing the full path of an existing group or dataset to which the attribute belongs. To read an attribute from the root group of the file, specify '/' as the location.

Attribute name, specified as a character vector or string scalar containing the name of an attribute belonging to a group or dataset.

Introduced in R2011a