datetime.topkrows
datetime: B = topkrows (A, K)
datetime: B = topkrows (A, K, col)
datetime: B = topkrows (A, K, direction)
datetime: B = topkrows (A, K, col, direction)
datetime: B = topkrows (…, 'MissingPlacement', MP)
datetime: [B, index] = topkrows (A, …)
Top K sorted rows of a datetime array.
B = topkrows (A, K) returns the top K rows
of the 2-D datetime array A sorted in descending order as a group.
K must be a nonnegative integer scalar. If K is larger than
the number of rows in A, then all of them are returned.
Missing elements (NaT) are not ranked. Within each sort
column they are placed after the elements that are defined, whichever
direction is asked for, so a row is demoted only by a missing element in
a column that actually decides its position. Rows comparing as equal
keep their original order.
B = topkrows (A, K, col) sorts using only
the columns listed in the numeric vector col, which must contain
positive integers indexing existing columns in A. Columns are used
as sort keys in the order given, and those not listed are not used at
all. The direction is descending unless direction says otherwise.
B = topkrows (A, K, direction) sorts in
the given direction, either 'descend' (default) or
'ascend' applying to all columns in A. Alternatively,
direction can be a cell array of character vectors specifying the
sorting direction for each individual column of A.
B = topkrows (A, K, col, direction)
combines an explicit column list with a per-column direction.
B = topkrows (…,
specifies where the missing elements are placed within each sort column,
with any of the following options specified in MP:
'MissingPlacement', MP)
'last', which is the default, places missing elements last
whichever direction is asked for.
'first' places missing elements first.
'auto' places missing elements last for an ascending sort
and first for a descending one, as sortrows does.
This is an Octave extension: MATLAB has no such option here and always
ranks as 'last' does.
[B, index] = topkrows (A, …) also returns
an index vector containing the original row indices of A in
B, such that B = A(index,:).
Source Code: datetime