I have a problem in Octave using huffmandict and huffmanenco.
Here is my error :
error: huffmanenco: all elements of SIG must be integers in the range [1,N]
Here is my code :
inputSig = [1 1 2 6 6 6 6 4 5 5];
list_symb = [1 2 6 4 5];
list_proba = [0.2, 0.1, 0.4, 0.1, 0.2];
dict = huffmandict(list_symb,list_proba);
code = huffmanenco(inputSig,dict);
my dict is
dict =
{
[1,1] = 1
[1,2] = 0 1
[1,3] = 0 0 1
[1,4] = 0 0 0 0
[1,5] = 0 0 0 1
}
So my error is with the line
code = huffmanenco(inputSig,dict);
because the lenght of my dict is 5 and my lenght of my inputSig is 10.
How can I do my huffman coding without this error?
However, this code seems to work on Matlab.