Counting number of each characters in a given textfile

1 次查看(过去 30 天)
Hello everyone, i am trying find a solution to count the number of each character(alphabet) . I have to find how many times each elements of alphabet used in a given textfile saved on my pc. Ok i found number of all characters but i do not know how to specify code for 'each' elements used in textfile. I have to show these numbers on histogram by comparing the avarege of each character. For ins. : 'e' is used 12 times in a textfile which has 100 characters and 'b' is used 14 times in a textfile and then histogram must be distribution of each elements.Please i am stuck help me. Thank in advance.

回答(1 个)

Walter Roberson
Walter Roberson 2012-2-25
Read the entire file in to one string, and run the histogram and that string.
Hint: the maximum possible character value in MATLAB is 65535.

Community Treasure Hunt

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

Start Hunting!

Translated by