datetime

Methods

Method Reference: datetime.union

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

Set union of two datetime arrays.

C = union (A, B) returns the unique datetime values present in either A or 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. Distinct NaT elements are all retained. C is a row vector when both A and B are row vectors and a column vector otherwise.

C = union (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 combined unique rows.

… = union (…, order) returns the values in 'sorted' order (the default) or in 'stable' order.

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

Source Code: datetime