FUNCTION REFERENCE

min

Smallest element.

Smallest element.

Syntax

[M,I] = min(A)

Syntax

[M,I] = min(A,[],dim) or min(A,[],vecdim) or min(A,[],'all')

Syntax

min(A,B) or min(A,B,nanflag)

For 2-D and N-D arrays, min(A) reduces the first non-singleton dimension. Specify a dimension, a vector of dimensions or 'all' to choose which elements to compare. Append 'omitnan' (default) to ignore NaNs or 'includenan' to propagate them. I gives the first minimum's position within each reduced slice in column-major order. Append 'linear' to get indices into A. With two arrays, min compares corresponding elements. Complex values are ordered by magnitude, then phase angle.

Example

min([3 9 2])   % 2

Example

[m,i] = min([3 NaN;1 2],[],'all','omitnan'); i   % 2

Differences from MATLAB: The 'ComparisonMethod' option is unsupported.

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.