imin

Syntax

imin(X)

Details

Returns the position of the minimum value in a vector or a matrix. If there are multiple identical minimum values, return the position of the first minimum value starting from the left. As with all aggregate functions, null values are not included in the calculation.

Parameters

X is a scalar/vector/matrix/table.

Returns

  • If X is a scalar or vector, return an INT scalar, indicating the position of the element with the minimum value.
  • If X is a matrix, return a vector containing the position of the element with the minimum value in each column.

  • If X is a table, return a table. Each column of the table contains the position of the element with the minimum value in the corresponding column of X.

Examples

x = 1.2 2 NULL -1 6 -1
imin(x);
// output: 3

x = 5 3 1 6 4 1 $ 3:2
imin(x);
// output: [2,2]
m=matrix(1 3 2 4, 4 2 3 1);
m;
#0 #1
1 4
3 2
2 3
4 1
imin(m);
// output: [0,3]