from Arithmetic coding and decoding for Text Compression by Madhu S. Nair
Arithmetic coding and decoding for Text Compression

arithint()
function arithint()
clc;
fid=fopen('seq1.txt','r');
seq=fread(fid,'*char');
fclose(fid);
seq=reshape(seq,1,length(seq));
[alpha cnt]=countmodel(seq);
if ~isempty(alpha)
    btag=arithintcod(alpha,cnt,seq);
    disp(strcat('Tag =',btag));
    seq=arithintdecod(btag,alpha,cnt,length(seq));
    disp('Sequence = ');
    disp(seq);
else
    display('Empty Sequence....');
end
end

Contact us at files@mathworks.com