Read attribute from HDF5 file
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'
filename
— File nameFile name, specified as a character vector or string scalar containing the name of an existing HDF5 file.
Depending on the location of your file, filename
can
take on one of these forms.
Location | Form | ||||||||
---|---|---|---|---|---|---|---|---|---|
Current folder | Specify the name of the file in
Example:
| ||||||||
Other folders | If the file is not in the current folder or in
a folder on the MATLAB® path, then specify the full or
relative path name in
Example:
Example:
| ||||||||
Remote Location | If the file is stored at a remote location,
then
Based on your
remote location,
For more information, see Work with Remote Data. Example:
|
loc
— Location in fileLocation 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.
attr
— Attribute nameAttribute name, specified as a character vector or string scalar containing the name of an attribute belonging to a group or dataset.
You have a modified version of this example. Do you want to open this example with your edits?