Main Content

matlab.io.hdf4.sd.getCompInfo

Namespace: matlab.io.hdf4.sd

Information about dataset compression

Syntax

[comptype,compparms] = getCompType(sdsID)

Description

[comptype,compparms] = getCompType(sdsID) retrieves the compression type and compression information for a dataset. comptype can be one of the following values.

'none'No compression
'rle'Run-length encoding
'nbit'NBIT compression
'skphuff'Skipping Huffman compression
'deflate'GZIP compression
'szip'SZIP compression

If comptype is 'none' or 'rle', then compparms is [].

If comptype is 'nbit', then compparms is a 4-element array.

compparm(1)sign_ext
compparm(2)fill_one
compparm(3)start_bit
compparm(4)bit_len

If comptype is 'deflate', then compparms contains the deflation value, a number between 0 and 9.

If comptype is 'szip', them compparms is a 5-element array. Consult the HDF Reference Manual for details on SZIP compression.

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

Examples

import matlab.io.hdf4.*
sdID = sd.start('myfile.hdf','create');
sdsID = sd.create(sdID,'temperature','double',[100 50]);
sd.setCompress(sdsID,'deflate',5);
[comptype,compparm] = sd.getCompInfo(sdsID);
sd.endAccess(sdsID);
sd.close(sdID);