isortTop

Syntax

isortTop(X, top, [ascending=true])

Arguments

X is a vector or a tuple of vectors of the same length.

top is a positive integer no more than the size of a vector in X.

ascending is a Boolean scalar or vector indicating whether to sort X (or vectors of X sequentially) in ascending order or descending order. The default value is true (ascending order).

Details

Return the first few elements of the result of isort(X, [ascending]).

Examples

$ isortTop(2 1 4 3 6 5, 3);
[1,0,3]

$ isortTop(2 1 4 3 6 5, 3, false);
[4,5,2]

$ x=1 1 2 2 3 3
$ y=1 2 1 2 1 2
$ isortTop([x,y], 3, [false, false]);
[2,3,1,0]