# min

Returns minimum values.

## Syntax

m = min(x)

m = min(x, [], dim)

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

m = min(x, y)

## Inputs

`x`- The matrix to query.
`y`- The second matrix for a pairwise query with
`x`. `dim`- The dimension on which to operate, or 'all'.

## Outputs

- m
- The minimum value(s).
- idx
- The index of each minimum value. Not valid for a pairwise query.

## Examples

Vector input with two outputs:

`[m,idx] = min([7,1,5])`

```
m = 1
idx = 2
```

Matrix input:

`m = min([1,6;2,7])`

```
m = [Matrix] 1 x 2
1 6
```

Matrix input with dimension:

`m = min([1,6;2,5],[],1)`

```
m = [Matrix] 1 x 2
1 5
```

Two matrix inputs:

`m = min([1,6;2,5],[1,2;3,4])`

```
m = [Matrix] 2 x 2
1 2
2 4
```

## Comments

For a single operand, the function returns the minimum element of each vector in the specified dimension. If the second output is requested, it contains the single index of each minimum element.

For two operands with common dimensions, the function returns the minimum element from each element pair. If an operand is a single element, it is compared with each element of the other operand.

NaN single values and elements in dense matrices are ignored except when there are no numeric values to compare.