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

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 日

1 投票

You can use the ismember(), hist(), or histc() functions.
bym
bym 2012 年 9 月 30 日

0 投票

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

カテゴリ

ヘルプ センター および File ExchangeElementary Math についてさらに検索

タグ

質問済み:

2012 年 9 月 30 日

Community Treasure Hunt

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

Start Hunting!

Translated by