This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Decode binary code using arithmetic decoding


dseq = arithdeco(code,counts,len)


dseq = arithdeco(code,counts,len) decodes the binary arithmetic code in the vector code to recover the corresponding sequence of len symbols. The vector counts represents the source's statistics by listing the number of times each symbol of the source's alphabet occurs in a test data set. This function assumes that the data in code was produced by the arithenco function.


collapse all

Set the counts vector so that a one occurs 99% of the time.

counts = [99 1];

Set the sequence length to 1000. Generate a random sequence.

len = 1000;
seq = randsrc(1,len,[1 2; .99 .01]);

Arithmetically encode the random sequence then, decode the encoded sequence.

code = arithenco(seq,counts);
dseq = arithdeco(code,counts,length(seq));

Verify that the deocoded sequence matches the original sequence.

ans =




This function uses the algorithm described in [1].


[1] Sayood, Khalid, Introduction to Data Compression, San Francisco, Morgan Kaufmann, 2000.

Introduced before R2006a

Was this topic helpful?