Size of the array after Huffman Encoding

2 vues (au cours des 30 derniers jours)
Ayesha
Ayesha le 18 Juin 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

Réponses (1)

José-Luis
José-Luis le 18 Juin 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()

Catégories

En savoir plus sur Large Files and Big Data dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by