min

Returns the minimum value of a matrix.

Syntax

R = min(x)

R = min(x, [], dim)

[R,idx] = min(...)

R = min(x, y)

Inputs

x
The matrix to query.
Any valid scalar | vector | matrix.
Type: double | integer | logical | struct | cell
Dimension: scalar | vector | matrix
y
The second matrix for a pairwise query with x.
Any valid scalar | vector | matrix.
Type: double | integer | logical | struct | cell
Dimension: scalar | vector | matrix
dim
The dimension on which to search.
Default: first non-singleton dimension.
Type: double | integer | logical | struct | cell
Dimension: scalar

Outputs

R
The minimum value(s).
Dimension: scalar | vector | matrix
idx
Index of minimum value(s). Not valid for a pairwise query.
Type: double
Dimension: scalar

Examples

Vector input with two outputs:

[R,IDX] = min([7,1,5])
R = 1
IDX = 2

Matrix input:

R = min([1,6;2,7])
R = [Matrix] 1 x 2
1 6

Matrix input with dimension:

R = min([1,6;2,5],[],1)
R = [Matrix] 1 x 2
1 5

Two matrix inputs:

R = min([1,6;2,5],[1,2;3,4])
R = [Matrix] 2 x 2
1  2
2  4

Comments

For a vector input, it returns the minimum element. For a matrix input, it returns the minimum element from each vector in the direction of interest. If two outputs are requested, it returns a matrix containing the minimum from each element pair.