Huffman
No License
HUFFMAN Huffman encoder.
C = HUFFMAN(D,W) generates a static minimum-variance Huffman tree and corresponding codebook C for the source symbols with nonnegative weights given by vector W, using a D-ary output code alphabet,
e.g. D = 2 for a binary output code alphabet.
W is an N-vector of nonnegative source symbol weights, where N is the number of source symbols.
The generated Huffman code C minimizes the weighted codeword length,
e.g. if the weight is the probability of the source symbol, then C minimizes the expected codeword length.
C is an N-vector of strings (i.e. cell array) giving the codewords for each of the N source symbols in W.
C = HUFFMAN(D,W,L,'screen') additionally displays a simple text rendition of the resulting Huffman code tree, with the source symbol labels given by L. L is an N-vector of strings (i.e. cell array)
containing the labels for each of the N source symbols.
C = HUFFMAN(D,W,L,'dot') additionally creates a DOT file describing the resulting Huffman code tree, and runs Graphviz DOT to create the
corresponding PNG image. The output files are automatically time-stamped. The source symbol labels are given by L, which is an N-vector of strings (i.e. cell array) containing the labels for each of the N source symbols. Please ensure that Graphviz DOT is accessible from the current directory (e.g. by adding it to the path).
Multiple output can be requested using a single command, e.g.
C = HUFFMAN(D,W,L,'dot','screen')
Cite As
Jaun Dough (2024). Huffman (https://www.mathworks.com/matlabcentral/fileexchange/15109-huffman), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
- MATLAB > Data Import and Analysis > Large Files and Big Data >
- Signal Processing > Wavelet Toolbox > Denoising and Compression >
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
Version | Published | Release Notes | |
---|---|---|---|
1.0.0.0 |