Main Content

matlab.io.hdf4.sd.readChunk

Namespace: matlab.io.hdf4.sd

Read chunk from dataset

Syntax

datachunk = readChunk(sdsID,origin)

Description

datachunk = readChunk(sdsID,origin) reads an entire chunk of data from the dataset identified by sdsID. The origin input specifies the location of the chunk in zero-based chunking coordinates, not in dataset coordinates.

This function corresponds to the SDreadchunk function in the HDF library C API, but because MATLAB® uses FORTRAN-style ordering, the origin parameter is reversed with respect to the C library API.

Examples

import matlab.io.hdf4.*
sdID = sd.start('sd.hdf');
idx = sd.nameToIndex(sdID,'temperature');
sdsID = sd.select(sdID,idx);
dataChunk = sd.readChunk(sdsID,[0 1]);
sd.endAccess(sdsID);
sd.close(sdID);