Size of the array after Huffman Encoding

2 visualizaciones (últimos 30 días)
Ayesha
Ayesha el 18 de Jun. de 2014
Respondida: José-Luis el 18 de Jun. de 2014
Hello,
I have observed that the size of the array generally increasing after huffman encoding process in MATLAB. For example:
sig = repmat([3 3 1 3 3 3 3 3 2 3],1,5); % Data to encode
symbols = [1 2 3]; % Distinct data symbols appearing in sig
p = [0.1 0.1 0.8]; % Probability of each data symbol
dict = huffmandict(symbols,p); % Create the dictionary.
hcode = huffmanenco(sig,dict); % Encode the data.
Here, sig: 1x50 double, however, after encoding, hcode becomes 1x60 double. I thought encoding process would reduce the number of elements. I would appreciate if someone could explain this and if possible, how to determine the size of array after encoding.
Thanks

Respuestas (1)

José-Luis
José-Luis el 18 de Jun. de 2014
The performance of encoding algorithms will depend on the structure of the underlying data. The combination of structure/algorithm will yield better or worse results depending on the fit. Sometimes you might get a longer file than what you originally had.
If you want to get the size of the array, please look at the built-in function size()

Categorías

Más información sobre Large Files and Big Data en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by