MATLAB Answers

0

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

Asked by Portgas Ace on 30 Sep 2012
Is there a specific 'find' function wherein i can check how many times a string/number is in an array?

  0 Comments

Sign in to comment.

Tags

2 Answers

Answer by Image Analyst
on 30 Sep 2012

You can use the ismember(), hist(), or histc() functions.

  0 Comments

Sign in to comment.


Answer by bym
on 30 Sep 2012

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

  0 Comments

Sign in to comment.