datetime.min
datetime: M = min (A)
datetime: M = min (A, B)
datetime: M = min (A, [], dim)
datetime: M = min (…, nanflag)
datetime: M = min (A, [], 'all')
datetime: [M, I] = min (…)
Minimum of a datetime array.
M = min (A) returns the smallest element of the
datetime array A along its first non-singleton dimension. For a
matrix, M is a row vector with the minimum of each column.
Not-A-Time (NaT) elements are omitted; a reduction over
NaT elements only yields NaT.
M = min (A, B) returns an array the same size as
A and B (after broadcasting) holding the element-wise minimum
of the two datetime arrays.
M = min (A, [], dim) operates along dimension
dim. The empty second argument distinguishes this from the
element-wise form.
M = min (…, nanflag) sets the treatment of
NaT: 'omitnan' (default) ignores NaT, while
'includenan' returns NaT whenever a NaT takes
part in the comparison.
M = min (A, [], returns the smallest
element of the whole array.
'all')
[M, I] = min (…) also returns the indices of the
minima. A second output is not available for the element-wise form.
Source Code: datetime
min returns the earliest datetime; a second output gives its index.
t = datetime (2024, 3, [9, 2, 20, 5])
t =
1x4 datetime array
09-Mar-2024 02-Mar-2024 20-Mar-2024 05-Mar-2024
[earliest, idx] = min (t)
earliest = datetime 02-Mar-2024 idx = 2