datetime

Methods

Method Reference: datetime.intersect

datetime: C = intersect (A, B)
datetime: C = intersect (A, B, 'rows')
datetime: C = intersect (…, order)
datetime: [C, ixA, ixB] = intersect (…)

Set intersection of two datetime arrays.

C = intersect (A, B) returns the unique datetime values common to both A and B. 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 operation. Membership is decided on the absolute instant, so two zoned inputs may be in different time zones; the result carries the time zone and display format of A. Not-A-Time (NaT) elements are treated like NaN and never match. C is a row vector when both A and B are row vectors and a column vector otherwise.

C = intersect (A, B, 'rows') treats each row of the datetime matrices A and B, which must have the same number of columns, as a single element and returns their common rows.

… = intersect (…, order) returns the values in 'sorted' order (the default) or in 'stable' order, i.e. the order in which they appear in A.

[C, ixA, ixB] = intersect (…) also returns index vectors ixA and ixB such that C = A(ixA) and C = B(ixB), or the corresponding row selections when 'rows' is used.

Source Code: datetime