Main Content

matlab.io.hdf4.sd.setChunk

Namespace: matlab.io.hdf4.sd

Set chunk size and compression method of dataset

Syntax

setChunk(sdsID,chunkSize,comptype,compparm)

Description

setChunk(sdsID,chunkSize,comptype,compparm) makes the dataset specified by sdsID a chunked dataset with chunk size given by chunkSize and compression specified by comptype and compparm. The comptype input can be one of the following values.

'none'No compression
'skphuff'Skipping Huffman compression
'deflate'GZIP compression
'rle'Run-length encoding

  • If comptype is 'none' or 'rle', then compparm need not be specified.

  • If comptype is 'skphuff', then compparm is the skipping size.

  • If comptype is 'deflate', then compparm is the deflate level, which must be between 0 and 9.

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

Examples

import matlab.io.hdf4.*
sdID = sd.start('myfile.hdf','create');
sdsID = sd.create(sdID,'temperature','double',[200 100]);
sd.setChunk(sdsID,[20 10],'skphuff',16);
sd.endAccess(sdsID);
sd.close(sdID);