Find how many times a word appeared in matrix

2 次查看(过去 30 天)
Hello, I'm trying to find out how many times a certain word appeared in a matrix. What command should i use?

回答(1 个)

Stephen23
Stephen23 2015-2-16
编辑:Stephen23 2015-2-16
A = {'anna','bob','cedric','diana','anna'};
B = 'anna';
N = sum(strcmp(A,B));

类别

Help CenterFile Exchange 中查找有关 Data Types 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by