How do I count the number of each particular entry in a variable
Show older comments
I have a list of words stored as a variable on matlab and I need to be able to 'pickout' and count the different words. I know you can do that using the strfind function. However it is in a column not a row (Input strings must have one row.)So my question is how do you fix this, or is there a better way to pick out and out the words. An example of my problem
I have stored in my workspace the variable "countries"
val=
AUS
CAD
USA
USA
...
now i need to be able to count the number of each occurrence of the countries like 2 USA 1 AUS 1 CAD etc
Thanks
Accepted Answer
More Answers (0)
Categories
Find more on Characters and Strings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!