duration

Methods

Method Reference: duration.linspace

duration: R = linspace (Start, End)
duration: R = linspace (Start, End, N)

Create linearly spaced duration elements.

R = linspace (Start, End) returns 100 linearly spaced elements between Start and End. If Start and End are scalars, then R is a vector. If one or both inputs are vectors, then R is a matrix where each row is an independent sequence between Start(idx_N) and End(idx_N).

R = linspace (Start, End, N) specifies the number (default is 100) of equally spaced elements between Start and End. If N is not an integer value, then it is floored to the nearest integer. If N is zero or negative, then an empty matrix is returned. If N is one, then End is returned. If N greater than one, then Start and End are always included in the range.

Either Start or End input arguments can also be one of the following types:

  • numeric scalar or vector (24-hour days)
  • character vector (duration string)
  • cellstr scalar or vector (duration strings)
  • string scalar or vector (duration strings)

Source Code: duration

Example: 1

linspace builds a fixed number of durations evenly spaced between two endpoints.

 linspace (hours (0), hours (2), 5)
ans =
  1x5 duration array

    0 hr    0.5 hr    1 hr    1.5 hr    2 hr