Main Content

matlab.io.hdf4.sd.readAttr

Namespace: matlab.io.hdf4.sd

Read attribute value

Syntax

data = readAttr(objID,idx)

Description

data = readAttr(objID,idx) reads the value of the attribute specified by index idx. The objID input can be an SD interface identifier, a dataset identifier, or a dimension identifier. idx is a zero-based index.

This function corresponds to the SDreadattr function in the HDF library C API.

Examples

import matlab.io.hdf4.*
sdID = sd.start('sd.hdf');
idx = sd.findAttr(sdID,'creation_date');
data = sd.readAttr(sdID,idx);
sd.close(sdID);