datetime

Methods

Method Reference: datetime.setdiff

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

Set difference of two datetime arrays.

C = setdiff (A, B) returns the unique datetime values in A that are not in 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. NaT elements in A are all retained, as they never match an element of B. C is a row vector when both A and B are row vectors and a column vector otherwise.

C = setdiff (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 the rows of A that are not rows of B.

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

[C, ixA] = setdiff (…) also returns an index vector ixA such that C = A(ixA), or C = A(ixA,:) when 'rows' is used.

Source Code: datetime