I have a large text file, and I need to calculate the number of times each individual letter occurs in the file. The easiest way I can think of to do that would be to have an array where each entry is a single char from the file, then run an array function on the whole thing and sum the number of times each letter is found. However I am having trouble getting the text from the file into a char array. I have tried using fileread, which reads the entire file to a single entry in a string array, and I have tried using textscan, which reads the file into a cell array split up by words. Does anyone know if I can just get the file straight into a char array?
MATLAB: How to read from a file into a char array
char arraycounting charsMATLABreading from file
Related Question
- How to get the least used character in the text file
- Read in Text File as string Array
- Reading a Column Vector of Strings from a *.txt file in Linux
- Text file i/o problem….I always get 0 with charnum …whats the problem with the code?
- If the file is not found or the character is not a valid char, the function should return a value -1.
- Extract data (timestamps) from csv file
Best Answer