You are now following this Submission
- You will see updates in your followed content feed
- You may receive emails, depending on your communication preferences
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 (2026). Huffman (https://www.mathworks.com/matlabcentral/fileexchange/15109-huffman), MATLAB Central File Exchange. Retrieved .
General Information
- Version 1.0.0.0 (35.8 KB)
-
No License
MATLAB Release Compatibility
- Compatible with any release
Platform Compatibility
- Windows
- macOS
- Linux
| Version | Published | Release Notes | Action |
|---|---|---|---|
| 1.0.0.0 |
