duration.isbetween
duration: TF = isbetween (D, lower, upper)
duration: TF = isbetween (D, lower, upper, intervalType)
Find duration elements within specified range.
TF = isbetween (D, lower, upper) returns a
logical array, TF, which is the same size as the input duration
array D and it contains true for each corresponding element
which is within the range specified by lower and upper and
false otherwise. lower and upper must be duration
arrays of compatible size with D or alternatively they can be
specified as a character vector, a cell array of character vectors or a
string array containing valid text duration representations.
TF = isbetween (D, lower, upper,
intervalType) specifies the type of interval for the lower
and upper bounds and it can be one of the following values.
'closed' (default) includes lower and upper bounds.
'open' excludes lower and upper bounds.
'openleft' or 'closedright' exclude the lower and
include the upper bound. They have identical behavior.
'closedleft' or 'openright' include the lower and
exclude the upper bound. They have identical behavior.
intervalType can be specified either as a character vector or a string scalar.
Source Code: duration
isbetween tests, element by element, whether each duration lies within the closed interval [lower, upper].
d = hours ([1, 5, 10])
d =
1x3 duration array
1 hr 5 hr 10 hr
isbetween (d, hours (2), hours (8))
ans = 0 1 0