function letcount(file)

if isunix
	[stat, str] = unix(['cat ' file]);
else
	[stat, str] = dos(['type ' file]);
end

letters = 'abcdefghijklmnopqrstuvwxyz';
caps = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
for n = 1:26
	count(n) = sum(str == letters(n)) + sum(str == caps(n));
end
bar(count)
ylabel 'Number of occurrences'
title(['Letter frequencies in ' file])
set(gca, 'XLim', [0 27], 'XTick', 1:26, 'XTickLabel', letters')
