user813853
user813853

Reputation:

How to get the most frequent value of vector on Matlab ?

I have a vector A that contains let say [1,2,2,4]. I am looking for a way to get the most frequent value on A (here 2).

Upvotes: 1

Views: 418

Answers (1)

Nitish
Nitish

Reputation: 7126

This is more a statistical question. The technical term for your request is mode.

So, in MATLAB, you can simply do:

A=[1,2,2,4]
[my_value,my_frequency]=mode(A)

Upvotes: 2

Related Questions