matlab.io.hdf4.sd.refToIndex
Namespace: matlab.io.hdf4.sd
Index of dataset corresponding to reference number
Syntax
idx = refToIndex(sdID,ref)
Description
idx = refToIndex(sdID,ref)
returns the index of the dataset identified by
its reference number ref
. The idx
output can then be
passed to sd.select
, to obtain a dataset identifier.
This function corresponds to the SDreftoindex
function
in the HDF library C API.
Examples
import matlab.io.hdf4.* sdID = sd.start('sd.hdf','read'); idx = sd.nameToIndex(sdID,'temperature'); sdsID = sd.select(sdID,idx); ref = sd.idToRef(sdsID); idx2 = sd.refToIndex(sdID,ref); sd.endAccess(sdsID); sd.close(sdID);