huffman coding of a sequence
[QT,QM]=huffcode(A)
vector representing a input sequence. A is converted in the function to type INT. The elements of A must be greater or equal 1.
A string containing 1s and 0s. QT represents the binary output sequence of the huffman coded signal. QT can be converted into a scalar vector with str2code.
the huffman code table, containg symbols, bit sequences and number of bits of a symbol
The function converts the scalar input sequence (vector or matrix) into a compressed bit sequence. The bit sequence is represented by a string containing 1s and 0s.
huffcode requires the function "fasthist" and "huffman". The reverse operation is performed by the scilab function "huffdeco".
// Generate a Testmatrix A=testmatrix('frk',10)+1; A=A(:).'; [QT,QM]=huffcode(A); disp('compressed Bit sequence:'); disp(QT); disp('Code Table:'); disp(QM);