duration

Methods

Method Reference: duration.minus

duration: C = minus (A, B)

Subtraction for duration arrays.

C = minus (A, B) is the equivalent of the syntax C = A - B and returns the subtraction of B from A by subtracting 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

minus (-) subtracts one duration from another.

 a = hours (3)
a =
  duration

   3 hr
 a - minutes (45)
ans =
  duration

   2.25 hr