Find how many times a word appeared in matrix

2 views (last 30 days)
Hello, I'm trying to find out how many times a certain word appeared in a matrix. What command should i use?

Answers (1)

Stephen23
Stephen23 on 16 Feb 2015
Edited: Stephen23 on 16 Feb 2015
A = {'anna','bob','cedric','diana','anna'};
B = 'anna';
N = sum(strcmp(A,B));

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!