datetime.maxk
datetime: B = maxk (A, K)
datetime: B = maxk (A, K, dim)
datetime: [B, index] = maxk (A, …)
Find the latest elements in a datetime array.
B = maxk (A, K) returns the K latest
elements of the datetime array A in descending order. If A
is a vector, then B is a vector with K elements. If A
is a matrix, then maxk operates along each column of A and
B has K rows. For multidimensional arrays, maxk
operates along the first non-singleton dimension. Elements are ranked
by the instant they name, so an array with a time zone is ranked by
absolute time rather than by its wall clock.
B = maxk (A, K, dim) operates along the
dimension specified by dim.
K must be a nonnegative integer scalar. If K is larger than the number of elements along the operating dimension, then all of them are returned. Infinite datetimes are ranked as ordinary values.
Missing elements (NaT) are not ranked. They are appended after
the ranked elements in their original order, and hence they only appear
in B when K exceeds the number of non-missing elements along
the operating dimension. Unlike sort, maxk has no
'MissingPlacement' option, since NaT elements are always
placed last. Elements comparing as equal keep their original order.
[B, index] = maxk (A, …) also returns an
index array containing the indices of the returned elements of A
along the operating dimension.
Source Code: datetime