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

arithscale()
function arithscale()
clc;
fid=fopen('seq.txt','r');
seq=fread(fid,'*char');
fclose(fid);
seq=reshape(seq,1,length(seq));
[alpha prob]=probmodel(seq);
if ~isempty(alpha)
 [tag mnm]=arithscalecod(alpha,prob,seq);
 disp(strcat('Tag =',tag));
 seq=arithscaledecod(tag,alpha,prob,length(seq),mnm);
 disp('Sequence = ');
 disp(seq);
else
    display('Empty Sequence....');
end
end

Contact us