duration

Methods

Method Reference: duration.center

duration: C = center (D)
duration: C = center (D, dim)
duration: C = center (D, vecdim)
duration: C = center (D, 'all')
duration: C = center (…, nanflag)

Center values in a duration array.

This method overloads the core center function for duration arrays. The functionality is identical to core center function. Type help center for more information.

Source Code: duration

Example: 1

center subtracts the mean from each element, so the result is centred on zero — the deviations from the average duration.

 d = hours ([1, 2, 3, 4, 5])
d =
  1x5 duration array

    1 hr    2 hr    3 hr    4 hr    5 hr
 center (d)
ans =
  1x5 duration array

    -2 hr    -1 hr    0 hr    1 hr    2 hr