duration.sign
duration: out = sign (D)
duration: out = sign (D, unit)
Compute the signum function for duration arrays.
out = sign (D) returns an array of doubles, out,
the same size as the duration array D, where each element has one
following values:
1 if the corresponding element of D is greater than 0.
0 if the corresponding element of D is equal to 0.
-1 if the corresponding element of D is less than 0.
NaN if the corresponding element of D is a missing value.
Source Code: duration
sign returns -1, 0 or 1 for negative, zero and positive durations.
d = hours ([-2, 0, 3])
d =
1x3 duration array
-2 hr 0 hr 3 hr
sign (d)
ans = -1 0 1