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