Navigation

Operators and Keywords

Function List:

C++ API

: mode (x)
: mode (x, dim)
: [m, f, c] = mode (…)

Compute the most frequently occurring value in a dataset (mode).

mode determines the frequency of values along the first non-singleton dimension and returns the value with the highest frequency. If two, or more, values have the same frequency mode returns the smallest.

If the optional argument dim is given, operate along this dimension.

The return variable f is the number of occurrences of the mode in the dataset.

The cell array c contains all of the elements with the maximum frequency.

See also: mean, median.

Package: octave