why won't this work?

1 view (last 30 days)
Henrik
Henrik on 15 Feb 2012
I want this code to read a text file, convert it to ASCII Characters, make a pie chart over the ten most occurring numbers, be able to change for instance an "a" to "c" (two steps) and the program to make two steps everywhere in the text and then print the new text.
Will be very grateful for your help!
fid=fopen('krypterad1.txt','rt');%Open text file
text = fscanf(fid,'%c',Inf);%Read text file
text = upper(text);%Convert to upper cases
nummer = double(text);%Convert text to Ascii
n = histc(nummer, 65:90);
for nummer =65:90;
for antal=1:n
end
end
[B,IX] = sort(n, 'descend');%Sort array B in descending order
fprintf('%d\n',B);%Print array B
pie(B(1,10)')%Make pie chart of the ten most occuring numbers in the array (doesn't work)
title('De 10 mest förekommande bokstäverna i texten')%Chart title
f = input('byt från ','s')
t = input('till ','s')
diff = double(t) - double(f)
for rulla = nummer-(diff)
if rulla<=64, rulla=rulla+26; end
if rulla>90, rulla=rulla-26; end
okodadtext = char(rulla);
fprintf('%s',okodadtext)
end

Answers (0)

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!