Find the number of times a number is in an array.

2 次查看(过去 30 天)
Is there a specific 'find' function wherein i can check how many times a string/number is in an array?

回答(2 个)

Image Analyst
Image Analyst 2012-9-30
You can use the ismember(), hist(), or histc() functions.

bym
bym 2012-9-30
one way
x = randi(10,100,1); %example data
>> sum(x==5)
ans =
8

类别

Help CenterFile Exchange 中查找有关 Multidimensional Arrays 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by