duration

Methods

Method Reference: duration.plus

duration: C = plus (A, B)

Addition for duration arrays.

C = plus (A, B) is the equivalent of the syntax C = A + B and returns the sum of A and B by adding the corresponding elements. A and B must be size compatible, which translates to they can be the same size, one can be scalar, or for every dimension, their dimension sizes must be equal or one of them must be 1. The size of C is determined by the size compatibility of A and B.

One of the input arguments can also be a numeric array in which case its elements are treated as a number of 24-hour days. If the second argument B is a calendarDuration arrays, then the returned array C is also a calendarDuration array.

Source Code: duration

Example: 1

plus (+) adds durations together, giving a duration.

 a = hours (2) + minutes (30)
a =
  duration

   2.5 hr
 a + seconds (45)
ans =
  duration

   2.5125 hr