duration.unique
duration: B = unique (A)
duration: B = unique (A, setOrder)
duration: B = unique (A, occurrence)
duration: B = unique (A, setOrder, occurrence)
duration: B = unique (A, occurrence, setOrder)
duration: B = unique (A, …, 'rows')
duration: [B, ixA, ixB] = unique (…)
Unique values in a duration array.
B = unique (A) returns the unique values of the
duration array A in sorted order.
B = unique (A, setOrder) returns the unique
values of the duration array A in an order as specified by
setOrder, which can be either of the following values:
'sorted' (default) returns the unique values sorted in
ascending order.
'stable' returns the unique values according to their order
of occurrence.
B = unique (A, occurrence) returns the unique
values of the duration array A according to their order of
occurrence. occurrence can be either of the following values:
'first' (default) returns the first occurrence of each
unique value, i.e. the lowest possible indices are returned.
'last' returns the last occurrence of each unique value,
i.e. the highest possible indices are returned.
You can specify setOrder and occurrence arguments together.
B = unique (A, …, returns the
unique rows of A by treating each row as a single entity. The
'rows')'rows' option can be used alone or in any combination with the
setOrder and occurrence arguments. 'rows' can be
placed at any position in the function’s argument list after the input
array A. However, this syntax is only valid for 2-dimensional
duration arrays.
[B, ixA, ixB] = unique (…) also returns
index vectors ixA and ixB using any of the previous syntaxes.
ixA and ixB map the arrays A and B to one another
such that B = A(ixA) and
A = B(ixB). When the 'rows' optional
argument is specified, then B = A(ixA,:) and
A = B(ixB,:).
Source Code: duration
unique returns the distinct durations in an array (equal spans count once).
d = hours ([2, 1, 2, 3, 1])
d =
1x5 duration array
2 hr 1 hr 2 hr 3 hr 1 hr
unique (d)
ans =
1x3 duration array
1 hr 2 hr 3 hr