duration

Methods

Method Reference: duration.maxk

duration: B = maxk (A, K)
duration: B = maxk (A, K, dim)
duration: [B, index] = maxk (A, …)

Find the largest elements in a duration array.

B = maxk (A, K) returns the K largest elements of the duration 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.

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. Inf and -Inf are ranked as ordinary values.

Missing elements (NaN) 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 NaN 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: duration