Loading [Contrib]/a11y/accessibility-menu.js
mode
Compute mode values.
Syntax
m=mode(x)
m=mode(x,dim)
[m,f,c]=mode(...)
- x
- Data sample.
- Type: double
- Dimension: vector | matrix
- dim
- Dimension on which to perform the calculation.
- Default: first non-singleton dimension.
- Type: integer
- Dimension: scalar
Outputs
- m
- The mode values. When multiple modes occur, the lowest value is reported.
- Dimension: scalar | vector | matrix
- f
- The frequency of the mode values.
- Dimension: scalar | vector | matrix
- c
- The values that occur at the maximum frequency.
- Type: cell
Example
a = [2, 5, 6, 7, 10, 7, 6, 7, 6];
[m,f,c] = mode(a)
m = 6
f = 3
c =
{
[1,1] [Matrix] 2 x 1
6
7
}