a =fileread('GreatExpectations.txt');w = regexpi(a, ' ', 'split');v = unique(w);n = length(v);counts = zeros(n,1);for i=1:n counts(i) = sum(strcmp(w, v{i}));endmost_frequent =max(counts)for i=1:n counts(i) = sum(strcmp(w, v{i}));endleast_frequent= min(counts)
MATLAB: How to get the program to display the most and least Freq used words? Tells me the # times used but I dont know how to get it to display the words. PLease Help!
for loopsMATLABstrcmp
Related Question
- Why am i getting error in making trapezoidal wave form
- How to find minima in specific regions & closest bin to value in Histogram
- Most frequent value in a 3D matrix other than 0
- How to find color pattern
- Find the column with the least number of 1s (ones) in it | Find column with at least one non zero element
- Find the cell which is containing a string
Best Answer