cummin
Cumulative minimum: running smallest value along an array.
Category: Data Import and Analysis > Descriptive Statistics
Syntax
M = cummin(A)
Running minimum along the first non-singleton dimension.
M = cummin(A, dim)
Along dimension dim.
Description
The result never increases. It is the mirror image of cummax and is handy for tracking the lowest price, the best (smallest) error so far in an optimization, or the floor of a series.
For a matrix, cummin(A) works down each column and cummin(A, 2) along each row.
Input arguments
A- Numeric array.
dim- Dimension to operate along.
Output arguments
M- Array of the same size as
A;M(k)is the smallest of the firstkelements.
Example
Best error so far
err = [5 3 4 1 2];
cummin(err)
Output
ans = 1×5
5 3 3 1 1