duration

Methods

Method Reference: duration.ismember

duration: TF = ismember (A, B)
duration: TF = ismember (A, B, 'rows')
duration: [TF, index] = ismember (…)
duration: [TF, index] = ismember (…, 'legacy')

Find duration 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. NaN elements are not equal with each other and always return false.

TF = ismember (A, B, 'rows') only applies to duration matrices with the same number of columns, in which case the logical vector TF contains 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. If the 'legacy' optional argument is specified, then the highest index of matched elements is returned. Unless multiple matches exist, the 'legacy' option has no effect on the returned index.

Source Code: duration

Example: 1

ismember tests, element by element, whether each duration appears in a second set.

 d = hours ([1, 2, 5])
d =
  1x3 duration array

    1 hr    2 hr    5 hr
 ismember (d, hours ([2, 3, 5]))
ans =

  0  1  1