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

1 回表示 (過去 30 日間)
Portgas Ace
Portgas Ace 2012 年 9 月 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 Center および File ExchangeNumeric Types についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by