matlab.io.hdf4.sd.setCompress
Namespace: matlab.io.hdf4.sd
Set compression method of dataset
Syntax
setCompress(sdsID,comptype,compparm)
Description
setCompress(sdsID,comptype,compparm) sets the compression scheme for the
specified dataset. The compression must be done before writing the dataset.
Specify comptype as one of these values.
'none' | No compression |
'skphuff' | Skipping Huffman compression |
'deflate' | GZIP compression |
'rle' | Run-length encoding |
If
comptypeis'none'or'rle', thencompparmneed not be specified.If
comptypeis'skphuff', thencompparmis the skipping size.If
comptypeis'deflate', thencompparmis the deflate level, which must be between 0 and 9.
This function corresponds to the SDsetcompress function
in the HDF library C API.
Examples
import matlab.io.hdf4.* sdID = sd.start('myfile.hdf','create'); sdsID = sd.create(sdID,'temperature','double',[200 100]); sd.setCompress(sdsID,'deflate',5); data = rand(200,100); sd.writeData(sdsID,[0 0],data); sd.endAccess(sdsID); sd.close(sdID);