datetime.ismember
datetime: TF = ismember (A, B)
datetime: TF = ismember (A, B, 'rows')
datetime: [TF, index] = ismember (…)
Test for datetime elements in a set.
TF = ismember (A, B) returns a logical array
TF of the same size as A containing true for each
corresponding element of A that is in B and false
otherwise. Either input may instead be a date/time character vector,
string array, or cell array of character vectors, which is promoted to a
datetime array before the test. Membership is decided on the absolute
instant, so two zoned inputs may be in different time zones. Similarly to
NaN values, Not-A-Time (NaT) elements are not equal with
each other and always return false.
TF = ismember (A, B, only
applies to datetime matrices with the same number of columns, in which
case the logical vector TF contains 'rows')true for each row of
A that is also a row in B. TF has the same number of
rows as A.
[TF, index] = ismember (A, B) also returns
an index array of the same size as A containing the lowest index in
B for each element of A that is a member of B and 0
otherwise. If the 'rows' optional argument is used, then the
returning index is a column vector with the same rows as A and it
contains the lowest index in B for each row of A that is a
member of B and 0 otherwise.
Source Code: datetime
ismember tests which datetimes also appear in a second set.
ismember (datetime (2024, 1, [1, 5, 9]), datetime (2024, 1, [1, 2, 3, 4, 5]))
ans = 1 1 0