Find how many times a word appeared in matrix

2 visualizaciones (últimos 30 días)
Belal Abboushi
Belal Abboushi el 16 de Feb. de 2015
Editada: Stephen23 el 16 de Feb. de 2015
Hello, I'm trying to find out how many times a certain word appeared in a matrix. What command should i use?

Respuestas (1)

Stephen23
Stephen23 el 16 de Feb. de 2015
Editada: Stephen23 el 16 de Feb. de 2015
A = {'anna','bob','cedric','diana','anna'};
B = 'anna';
N = sum(strcmp(A,B));

Categorías

Más información sobre Characters and Strings en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by