%% File: p2.m
%% Read all characters of Coriolanus as ASCII codes
f=fopen('TextCompression/coriolan.txt','r');
A=fread(f,inf,'uint8');
fclose(f);
%% Conduct frequency analysis (build "table")
% C is the alphabet: as per documentation 
% of unique, IA and IC are index arrays s.t.
%      C = A(IA) and A = C(IC)
[C,IA,IC]=unique(A);
table=histcounts(IC,1:(length(C)+1));
%% Bar plots of alphabet and table
bar(C);bar(table)
