Note: This page has been translated by MathWorks. Please click here

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Most frequent values in array

returns
the sample mode of `M`

= mode(`A`

)`A`

, which is the most frequently
occurring value in `A`

. When there are multiple values
occurring equally frequently, `mode`

returns the
smallest of those values. For complex inputs, the smallest value is
the first value in a sorted list.

If

`A`

is a vector, then`mode(A)`

returns the most frequent value of`A`

.If

`A`

is a nonempty matrix, then`mode(A)`

returns a row vector containing the mode of each column of`A`

.If

`A`

is an empty 0-by-0 matrix,`mode(A)`

returns`NaN`

.If

`A`

is a multidimensional array, then`mode(A)`

treats the values along the first array dimension whose size does not equal`1`

as vectors and returns an array of most frequent values. The size of this dimension becomes`1`

while the sizes of all other dimensions remain the same.

`histcounts`

| `histogram`

| `mean`

| `median`

| `sort`

Was this topic helpful?