why won’t this work?
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(‘%dn’,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)
endI 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(‘%dn’,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 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(‘%dn’,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 for loop, pie, if statement MATLAB Answers — New Questions