B = topkrows(A, k)
B = topkrows(A, k, col)
B = topkrows(A, k, col, direction)
[B, I] = topkrows(...)
| Parameter | Description |
|---|---|
| A | a matrix. |
| k | the number of rows to return. |
| col | the columns used for sorting (default all). |
| direction | 'descend' (default) or 'ascend'. |
| Parameter | Description |
|---|---|
| B | the first k rows of the sorted matrix. |
| I | the indices such that B = A(I, :). |
B = topkrows(A, k) returns the first k rows of A sorted in descending order.
[B, I] = topkrows([3 1; 1 2; 2 9], 2)
| Version | Description |
|---|---|
| 2.0.0 | initial version |