duration
datatypes: duration
Array representing durations of time using fixed-length time units.
duration values are stored internally as double type array
representing numbers of elapsed days as a fixed-length time unit. By
default, fractional seconds of duration values are not displayed, but their
actual precision is closer to nanoseconds for typical time lengths.
duration arrays can be created through their constructor by
combining numeric arrays representing individual fixed-length elapsed time
units or through the functions years, days, hours,
minutes, seconds, and calyears, which create
fixed-length durations in terms of a single duration units. These
functions are also available as methods of duration arrays to
extract individual duration units as numeric arrays.
See also: calendarDuration, datetime
Source Code: duration
Display format, specified as a character vector or string scalar. If specified as a string scalar, it is converted and stored internally as a character vector.
duration: D = duration (X)
duration: D = duration (H, MI, S)
duration: D = duration (H, MI, S, MS)
duration: D = duration (TimeStrings)
duration: D = duration (TimeStrings, 'InputFormat', INFMT)
duration: D = duration (…, 'Format', FMT)
D = duration (X) creates a column vector of durations
from a numeric matrix.
D = duration (H, MI, S) creates a duration
array from numeric arrays containing the number of hours, minutes, and
seconds specified by H, MI and S, respectively.
D = duration (H, MI, S, MS) creates
a duration array from numeric arrays containing the number of hours,
minutes, seconds, and milliseconds specified by H, MI,
S, and MS, respectively.
D = duration (TimeStrings) creates a duration array
from text that represents elapsed times. TimeStrings can be a
character vector, a cell array of character vectors, or a string array
representing times using either the 'hh:mm:ss' or the
'dd:hh:mm:ss' format.
D = duration (TimeStrings, 'InputFormat',
INFMT) creates a duration array from text that represents elapsed
times according to the format specified by INFMT, which can be any
of the following:
'dd:hh:mm:ss'
'hh:mm:ss'
'mm:ss'
'hh:mm'
S characters to indicate fractional second digits, such as
'dd:hh:mm:ss.SS' or 'mm:ss.SS'.
D = duration (…,
specifies the format in which D is displayed. FMT can
specify either a digital timer, which can have any of the valid formats
for 'Format', FMT)'InputFormat' as shown above or a single number with time
units by specifying one of the following:
'y' fixed-length years (1 year equals 365.2425 days)
'd' fixed-length days (1 day equals 24 hours)
'h' hours
'm' minutes
's' seconds
D = duration () returns a scalar array of durations with an
elapsed time value of zero. To create an empty duration array, use
duration ([], [], []).
See also: years, days, hours, minutes, seconds, milliseconds, duration, isduration, calendarDuration, datetime
duration: cstr = dispstrings (D)
cstr = dispstrings (D) returns a cellstr array of
character vectors, cstr, which has the same size as the input
duration D.
duration: cstr = cellstr (D)
duration: cstr = cellstr (D, Format)
cstr = cellstr (D) returns a cellstr array of
character vectors, cstr, which has the same size as the input
duration D.
duration: cmat = char (D)
cmat = char (D) returns a character matrix with one
row per element in D.
duration: DV = datevec (DT)
duration: [Y, MO, D, h, mi, s] = datevec (DT)
DV = datevec (DT) returns an numeric matrix
whose rows represent each element in DT and each column corresponds
to years, months, days, hours, minutes, and seconds, respectively. Since
months cannot be represented as a fixed length of time, the second column
of DV is always zero. DV represents a length of time split
across different fixed-length elapsed time units. The number of rows in
DV equals to the number of elements in the duration array DT.
[Y, MO, D, h, mi, s] = datevec
(DT) returns the components of DT as individual variables,
but unlike DV in the previous syntax, each variable has the same
size as the duration array DT.
Values containing a fractional portion less than 1 picosecond are rounded to the nearest picosecond.
duration: H = hms (D)
duration: [H, M] = hms (D)
duration: [H, M, S] = hms (D)
[H, M, S] = hms (D) splits the duration
array D into separate numeric arrays H, M, and S,
which correspond to hours, minutes, and seconds, respectively. Hours and
minutes are returned as whole numbers, while seconds may also have a
fractional part.
Values containing a fractional portion less than 1 picosecond are rounded to the nearest picosecond.
duration: X = years (D)
X = years (D) converts durations in D to the
equivalent number of fixed-length years (1 year equals 365.2425 days).
X is a double array of the same size as D.
duration: X = days (D)
X = days (D) converts durations in D to the
equivalent number of fixed-length days (1 day equals 24 hours). X
is a double array of the same size as D.
duration: X = hours (D)
X = hours (D) converts durations in D to the
equivalent number of hours. X is a double array of the same size
as D.
duration: X = minutes (D)
X = minutes (D) converts durations in D to the
equivalent number of minutes. X is a double array of the same size
as D.
Values containing a fractional portion less than 1 picosecond are rounded to the nearest picosecond.
duration: X = seconds (D)
X = seconds (D) converts durations in D to the
equivalent number of seconds. X is a double array of the same size
as D.
Values containing a fractional portion less than 1 picosecond are rounded to the nearest picosecond.
duration: X = milliseconds (D)
X = milliseconds (D) converts durations in D to
the equivalent number of milliseconds. X is a double array of the
same size as D.
Values containing a fractional portion less than 1 picosecond are rounded to the nearest picosecond.
duration: sz = size (D)
duration: dim_sz = size (D, dim)
duration: dim_sz = size (D, d1, d2, …)
duration: [rows, columns, …, dim_n_sz] = size (…)
sz = size (D) returns a row vector with the size
(number of elements) of each dimension for the duration array D.
dim_sz = size (D, dim) returns the size of
the corresponding dimension specified in dim. If dim is a
vector, then dim_sz is a vector of the same length and with each
element corresponding to a specified dimension. Multiple dimensions may
also be specified as separate arguments.
With a single output argument, size returns a row vector. When
called with multiple output arguments, size returns the size of
dimension N in the Nth argument.
duration: out = ndims (D)
out = ndims (D) returns the number of dimensions of
the duration array D.
duration: out = numel (D)
For compatibility reasons with Octave’s OOP interface and subsasgn
behavior, duration’s numel is defined to always return 1.
duration: out = nnz (D)
out = nnz (D) returns the number of nonzero
elements in the duration array D.
duration: N = length (D)
N = length (D) returns the size of the longest
dimension of the duration array D, unless any of its dimensions has
zero length, in which case length (D) returns 0.
duration: hey = keyHash (D)
h = keyHash (D) generates a uint64 scalar that
represents the input array D. keyHash utilizes the 64-bit
FNV-1a variant of the Fowler-Noll-Vo non-cryptographic hash function.
h = keyHash (D, base) also generates a 64-bit
hash code using base as the offset basis for the FNV-1a hash
algorithm. base must be a uint64 integer type scalar. Use
this syntax to cascade keyHash on multiple objects for which a
single hash code is required.
Note that unlike MATLAB, this implementation does no use any random seed.
As a result, keyHash will always generate the exact same hash key
for any particular input across different workers and Octave sessions.
duration: TF = isbetween (D, lower, upper)
duration: TF = isbetween (D, lower, upper, intervalType)
TF = isbetween (D, lower, upper) returns a
logical array, TF, which is the same size as the input duration
array D and it contains true for each corresponding element
which is within the range specified by lower and upper and
false otherwise. lower and upper must be duration
arrays of compatible size with D or alternatively they can be
specified as a character vector, a cell array of character vectors or a
string array containing valid text duration representations.
TF = isbetween (D, lower, upper,
intervalType) specifies the type of interval for the lower
and upper bounds and it can be one of the following values.
'closed' (default) includes lower and upper bounds.
'open' excludes lower and upper bounds.
'openleft' or 'closedright' exclude the lower and
include the upper bound. They have identical behavior.
'closedleft' or 'openright' include the lower and
exclude the upper bound. They have identical behavior.
intervalType can be specified either as a character vector or a string scalar.
duration: TF = iscolumn (D)
TF = iscolumn (D) returns a logical scalar TF,
which is true if the duration array D is a column vector
and false otherwise. A column vector is a 2-D array for which
size (D) returns [N, 1] with non-negative
N. By definition, a scalar is also a column vector.
duration: TF = isempty (D)
TF = isempty (D) returns a logical scalar TF,
which is true if the duration array D is empty and
false otherwise.
duration: TF = isequal (D1, D2)
duration: TF = isequal (D1, D2, …)
TF = isequal (D1, D2) returns a logical scalar
TF, which is true, if the duration arrays D1 and
D2 contain the same values, and false otherwise. Either
D1 or D2 can also be specified as a character vector, a cell
array of character vectors or a string array containing valid text
duration representations.
TF = isequal (D1, D2, …) returns a logical
scalar TF, which is true, if all input arguments are equal,
and false otherwise.
duration: TF = isequaln (D1, D2)
duration: TF = isequaln (D1, D2, …)
TF = isequaln (D1, D2) returns a logical scalar
TF, which is true, if the duration arrays D1 and
D2 contain the same values or corresponding missing elements, and
false otherwise. Either D1 or D2 can also be
specified as a character vector, a cell array of character vectors or a
string array containing valid text duration representations.
TF = isequaln (D1, D2, …) returns a logical
scalar TF, which is true, if all input arguments are equal
under the assumption that missing elements are equal, and false
otherwise.
duration: TF = isfinite (D)
TF = isfinite (D) returns a logical array TF
of the same size as calD containing true for each
corresponding element of D that is finite and false
otherwise. Finite elements are those which are neither infinite nor
Not-A-Number.
duration: TF = isinf (D)
TF = isinf (D) returns a logical array TF
of the same size as D containing true for each
corresponding element of calD that is either Inf or
-Inf and false otherwise.
duration: TF = ismatrix (D)
TF = ismatrix (D) returns a logical scalar TF,
which is true if the duration array D is a matrix and
false otherwise. A matrix is an array of any type where
ndims (D) == 2. By definition, a scalar is also a matrix.
duration: TF = ismember (A, B)
duration: TF = ismember (a, s, 'rows')
duration: [TF, index] = ismember (…)
duration: [TF, index] = ismember (…, 'legacy')
TF = ismember (A, B) returns a logical array
TF of the same size as A containing true for each
corresponding element of A that is in B and false
otherwise. NaN elements are not equal with each other and always
return false.
TF = ismember (A, B, only
applies to duration matrices with the same number of columns, in which
case the logical vector TF contains 'rows')true for each row of
A that is also a row in B. TF has the same number of
rows as A.
[TF, index] = ismember (A, B) also returns
an index array of the same size as A containing the lowest index in
B for each element of A that is a member of B and 0
otherwise. If the 'rows' optional argument is used, then the
returning index is a column vector with the same rows as A and it
contains the lowest index in B for each row of A that is a
member of B and 0 otherwise. If the 'legacy' optional
argument is specified, then the highest index of matched elements is
returned. Unless multiple matches exist, the 'legacy' option has
no effect on the returned index.
duration: TF = ismissing (D)
duration: TF = ismissing (D, indicator)
TF = ismissing (D) returns a logical array, TF,
with the same dimensions as D, where true values match the
standard missing values in the input duration array.
The optional input indicator can be a scalar or a vector duration array, specifying alternative missing values in the input data. When specifying indicator values, the standard missing values are ignored, unless explicitly stated in the indicator.
duration: TF = isnan (D)
TF = isnan (D) returns a logical array TF of
the same size as D containing true for each corresponding
element of calD that is NaN and false otherwise.
duration: TF = isrow (D)
TF = isrow (D) returns a logical scalar TF,
which is true if the duration array D is a row vector
and false otherwise. A row vector is a 2-D array for which
size (D) returns [1, N] with non-negative
N. By definition, a scalar is also a row vector.
duration: TF = isscalar (D)
TF = isscalar (D) returns a logical scalar TF,
which is true if the duration array D is also a scalar
and false otherwise. A scalar is a single element object for
which size (D) returns [1, 1].
duration: TF = issorted (D)
duration: TF = issorted (D, dim)
duration: TF = issorted (D, direction)
duration: TF = issorted (D, dim, direction)
duration: TF = issorted (…, 'MissingPlacement', MP)
duration: TF = issorted (…, 'ComparisonMethod', CM)
TF = issorted (D) returns a logical scalar TF,
which is true, if the duration array D is sorted in
ascending order, and false otherwise.
TF = issorted (D, dim) returns a logical scalar
TF, which is true, if the duration array D is
sorted in ascending order along the dimension dim, and
false otherwise.
TF = issorted (D, direction) returns a logical
scalar TF, which is true, if the duration array D
is sorted in the direction specified by direction, and
false otherwise. direction can be any of the following
options:
'ascend', which is the default, checks is elements are in
ascending order.
'descend' checks if elements are in descending order.
'monotonic' checks if elements are either in ascending or
descending order.
'strictascend' checks if elements are in ascending order
and there are no duplicate or undefined elements.
'strictdescend' checks if elements are in descending order
and there are no duplicate or undefined elements.
'strictmonotonic' checks if elements are either in
ascending or descending order and there are no duplicate or undefined
elements.
TF = issorted (…,
specifies where missing elements ('MissingPlacement', MP)NaN) are placed with one of the
following options specified in MP:
'auto', which is the default, places missing elements last
for ascending sort and first for descending sort.
'first' places missing elements first.
'last' places missing elements last.
TF = issorted (…,
specifies the comparison method for determining the order of elements
with one of following options specified in CM:
'ComparisonMethod', CM)
'auto', which is the default, sorts by real (A).
'real' sorts by real (A).
'abs' sorts by abs (A).
duration: TF = issortedrows (D)
duration: TF = issortedrows (D, col)
duration: TF = issortedrows (D, direction)
duration: TF = issortedrows (D, col, direction)
duration: TF = issortedrows (…, 'MissingPlacement', MP)
duration: TF = issortedrows (…, 'ComparisonMethod', CM)
TF = issortedrows (D) returns a logical scalar
TF, which is true, if the rows in the 2-D duration array
D are sorted in ascending order, and false otherwise.
TF = issortedrows (D, col) returns a logical
scalar TF, which is true, if the duration array D
is sorted according to the columns specified by the vector col, and
false otherwise. col must explicitly contain non-zero
integers whose absolute values index existing columns in D.
Positive elements sort the corresponding columns in ascending order,
while negative elements sort the corresponding columns in descending
order.
TF = issortedrows (D, direction) checks if the
rows in D are sorted according to the specified direction, which
can be one of the following options:
'ascend', which is the default, checks is elements are in
ascending order.
'descend' checks if elements are in descending order.
'monotonic' checks if elements are either in ascending or
descending order.
'strictascend' checks if elements are in ascending order
and there are no duplicate or undefined elements.
'strictdescend' checks if elements are in descending order
and there are no duplicate or undefined elements.
'strictmonotonic' checks if elements are either in
ascending or descending order and there are no duplicate or undefined
elements.
Alternatively, direction can be a cell array of character vectors specifying the sorting direction for each individual column of D, in which case the number of elements in direction must equal the number of columns in D.
TF = issortedrows (D, col, direction)
checks if the rows in the duration array D are sorted according
to the columns specified in col using the corresponding sorting
direction specified in direction. In this case, the sign of the
values in col is ignored. col and direction must have
the same length, but not necessarily the same number of elements as the
columns in D.
TF = issortedrows (…, specifies where missing elements ('MissingPlacement',
MP)<undefined>) are
placed with one of the following options specified in MP:
'auto', which is the default, places missing elements last
for ascending sort and first for descending sort.
'first' places missing elements first.
'last' places missing elements last.
TF = issortedrows (…, specifies the comparison method for determining the order of
elements with one of following options specified in CM:
'ComparisonMethod',
CM)
'auto', which is the default, sorts by real (A).
'real' sorts by real (A).
'abs' sorts by abs (A).
duration: TF = isvector (D)
TF = isvector (D) returns a logical scalar TF,
which is true if the duration array D is a vector and
false otherwise. A vector is a 2-D array for which one of the
dimensions is equal to 1 (either or ). By
definition, a scalar is also a vector.
duration: TF = eq (A, B)
TF = eq (A, B) is the equivalent of the syntax
TF = A == B and returns a logical array whose
elements set to true where the corresponding elements of A
and B are equal and set to false otherwise.
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 character vector, a cell array of character vectors, or a string array representing duration strings or a numeric array representing days.
duration: TF = ge (A, B)
TF = ge (A, B) is the equivalent of the syntax
TF = A >= B and returns a logical array whose
elements set to true where the corresponding elements of A
are greater than or equal to B and set to false otherwise.
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 character vector, a cell array of character vectors, or a string array representing duration strings or a numeric array representing days.
duration: TF = gt (A, B)
TF = gt (A, B) is the equivalent of the syntax
TF = A > B and returns a logical array whose
elements set to true where the corresponding elements of A
are greater than B and set to false otherwise.
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 character vector, a cell array of character vectors, or a string array representing duration strings or a numeric array representing days.
duration: TF = le (A, B)
TF = le (A, B) is the equivalent of the syntax
TF = A <= B and returns a logical array whose
elements set to true where the corresponding elements of A
are less than or equal to B and set to false otherwise.
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 character vector, a cell array of character vectors, or a string array representing duration strings or a numeric array representing days.
duration: TF = lt (A, B)
TF = lt (A, B) is the equivalent of the syntax
TF = A < B and returns a logical array whose
elements set to true where the corresponding elements of A
are less than B and set to false otherwise.
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 character vector, a cell array of character vectors, or a string array representing duration strings or a numeric array representing days.
duration: TF = ne (A, B)
TF = ne (A, B) is the equivalent of the syntax
TF = A != B and returns a logical array whose
elements set to true where the corresponding elements of A
and B are not equal and set to false otherwise.
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 character vector, a cell array of character vectors, or a string array representing duration strings or a numeric array representing days.
duration: B = abs (A)
B = abs (A) returns the absolute value of each element
in the duration array A. The returned duration array B has
the same size as the input array A.
duration: C = plus (A, B)
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.
duration: B = uplus (A)
B = uplus (A) is the equivalent of the syntax
B = + A and returns the input array unaltered.
duration: C = minus (A, B)
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.
duration: B = uminus (A)
B = uminus (A) is the equivalent of the syntax
B = - A and returns the input array with its elements
negated.
duration: C = times (A, B)
C = times (A, B) is the equivalent of the syntax
C = A .* B and returns the element-by-element
multiplication product between the corresponding elements of input arrays
A and B, one of which must be a numeric array and the other a
duration array.
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.
duration: C = times (A, B)
C = mtimes (A, B) is the equivalent of the
syntax C = A * B and returns the matrix
multiplication product of input arrays A and B, one of which
must be a numeric array and the other a duration array.
The columns of A must equal the rows of B and the size of C is determined by the rows of A and the columns of B.
duration: C = ldivide (A, B)
C = ldivide (A, B) is the equivalent of the
syntax C = A .\ B and returns the element-wise
division of the duration array B by the corresponding elements of
input array A, which can either be a duration or a numeric array.
If A is a duration array, then C is a double numeric array.
If A is a numeric array, then C is a duration array.
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.
duration: C = rdivide (A, B)
C = rdivide (A, B) is the equivalent of the
syntax C = A ./ B and returns the element-wise
division of the duration array A by the corresponding elements of
input array B, which can either be a duration or a numeric array.
If B is a duration array, then C is a double numeric array.
If B is a numeric array, then C is a duration array.
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.
duration: R = colon (Base, Limit)
duration: R = colon (Base, Increment, Limit)
R = colon (Base, Limit) is the equivalent of the
syntax C = Base:Limit and returns a duration
vector in the range from Base to Limit incremented by 24-hour
days.
R = colon (Base, Increment, Limit) is
equivalent to C = Base:Increment:Limit.
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.
As long as one of the inputs is a duration scalar, the following types are additionally supported for the remaining input arguments:
duration: R = linspace (Start, End)
duration: R = linspace (Start, End, N)
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:
duration: DT = diff (D)
duration: DT = diff (D, K)
duration: DT = diff (D, K, DIM)
This method overloads the core diff function for duration arrays.
The functionality is identical to core diff function. Type
help diff for more information.
duration: S = sum (D)
duration: S = sum (D, dim)
duration: S = sum (D, vecdim)
duration: S = sum (D, 'all')
duration: S = sum (…, nanflag)
This method overloads the core sum function for duration arrays.
The functionality is identical to core sum function. Type
help sum for more information.
duration: CS = cumsum (D)
duration: CS = cumsum (D, dim)
duration: CS = cumsum (D, vecdim)
duration: CS = cumsum (D, 'all')
duration: CS = cumsum (…, direction)
duration: CS = cumsum (…, nanflag)
This method overloads the core cumsum function for duration
arrays. The functionality is identical to core cumsum function.
Type help cumsum for more information.
duration: M = min (D)
duration: M = min (D, [], dim)
duration: M = min (D, [], vecdim)
duration: M = min (D, [], 'all')
duration: M = min (D, [], nanflag)
duration: M = min (D, [], …, nanflag)
duration: [M, index] = min (…)
duration: [M, index] = min (…, 'linear')
duration: M = min (D1, D2)
duration: M = min (D1, D2, nanflag)
duration: … = min (…, 'ComparisonMethod', method)
This method overloads the core min function for duration
arrays. The functionality is identical to core min function.
Type help min for more information.
duration: M = cummin (D)
duration: M = cummin (D, dim)
duration: M = cummin (D, vecdim)
duration: M = cummin (D, 'all')
duration: M = cummin ([], nanflag)
duration: M = cummin ([], direction)
duration: [M, index] = cummin (…)
duration: [M, index] = cummin (…, 'linear')
duration: … = cummin (…, 'ComparisonMethod', method)
This method overloads the core cummin function for duration
arrays. The functionality is identical to core cummin function.
Type help cummin for more information.
duration: M = max (D)
duration: M = max (D, [], dim)
duration: M = max (D, [], vecdim)
duration: M = max (D, [], 'all')
duration: M = max (D, [], nanflag)
duration: M = max (D, [], …, nanflag)
duration: [M, index] = max (…)
duration: [M, index] = max (…, 'linear')
duration: M = max (D1, D2)
duration: M = max (D1, D2, nanflag)
duration: … = max (…, 'ComparisonMethod', method)
This method overloads the core max function for duration
arrays. The functionality is identical to core max function.
Type help max for more information.
duration: M = cummax (D)
duration: M = cummax (D, dim)
duration: M = cummax (D, vecdim)
duration: M = cummax (D, 'all')
duration: M = cummax ([], nanflag)
duration: M = cummax ([], direction)
duration: [M, index] = cummax (…)
duration: [M, index] = cummax (…, 'linear')
duration: … = cummax (…, 'ComparisonMethod', method)
This method overloads the core cummax function for duration
arrays. The functionality is identical to core cummax function.
Type help cummax for more information.
duration: Y = floor (D)
duration: Y = floor (D, unit)
Y = floor (D) rounds each element of the duration
array D to the largest integer number of seconds not greater than
that element.
Y = floor (D, unit) rounds each element of the
duration array D to the largest integer number of the specified
unit of time not greater than that element. unit must be one of
the following values:
'seconds' (default)
'minutes'
'hours'
'days'
'years'
duration: Y = ceil (D)
duration: Y = ceil (D, unit)
Y = ceil (D) rounds each element of the duration
array D to the smallest integer number of seconds not less than
that element.
Y = ceil (D, unit) rounds each element of the
duration array D to the smallest integer number of the specified
unit of time not less than that element. unit must be one of the
following values:
'seconds' (default)
'minutes'
'hours'
'days'
'years'
duration: Y = round (D)
duration: Y = round (D, unit)
Y = round (D) rounds each element of the duration
array D to the nearest integer number of seconds to that element.
In case of a tie, return the one further away from zero.
Y = round (D, unit) rounds each element of the
duration array D to the nearest integer number of the specified
unit of time to that element. unit must be one of the following
values:
'seconds' (default)
'minutes'
'hours'
'days'
'years'
duration: out = sign (D)
duration: out = sign (D, unit)
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.
duration: [s, l] = bounds (D)
duration: [s, l] = bounds (D, dim)
duration: [s, l] = bounds (D, vecdim)
duration: [s, l] = bounds (D, 'all')
duration: [s, l] = bounds (…, nanflag)
This method is a specialization of the core bounds function for
duration arrays. The functionality is identical to core bounds
function. Type help bounds for more information.
duration: C = center (D)
duration: C = center (D, dim)
duration: C = center (D, vecdim)
duration: C = center (D, 'all')
duration: C = center (…, nanflag)
This method overloads the core center function for duration
arrays. The functionality is identical to core center function.
Type help center for more information.
duration: n = histc (D, edges)
duration: n = histc (D, edges, dim)
duration: [n, idx] = histc (…)
This method overloads the core histc function for duration
arrays. The functionality is identical to core histc function.
Type help histc for more information.
duration: r = iqr (D)
duration: r = iqr (D, dim)
duration: r = iqr (D, vecdim)
duration: r = iqr (D, 'all')
duration: [r, q] = iqr (…)
This method overloads the core iqr function for duration arrays.
The functionality is identical to core iqr function.
Type help iqr for more information.
duration: k = kurtosis (D)
duration: k = kurtosis (D, flag)
duration: k = kurtosis (D, flag, dim)
duration: k = kurtosis (D, flag, vecdim)
duration: k = kurtosis (D, flag, 'all')
This method overloads the core kurtosis function for duration
arrays. The functionality is identical to core kurtosis function.
Type help kurtosis for more information.
Note that kurtosis is a dimensionless quantity Thus, the returned argument is a numeric array of double type and not a duration array.
duration: M = mad (D)
duration: M = mad (D, opt)
duration: M = mad (D, opt, dim)
duration: M = mad (D, opt, vecdim)
duration: M = mad (D, opt, 'all')
This method overloads the core mad function for duration arrays.
The functionality is identical to core mad function.
Type help mad for more information.
duration: E = mape (F, A)
duration: E = mape (F, A, dim)
duration: E = mape (F, A, vecdim)
duration: E = mape (F, A, 'all')
duration: E = mape (…, nanflag)
duration: E = mape (…, zeroflag)
duration: E = mape (…, 'Weights', W)
This method overloads the core mape function for duration arrays.
The functionality is identical to core mape function.
Type help mape for more information.
Note that MAPE is expressed as a percentage. Thus, the returned argument is a numeric array of double type and not a duration array. However, both F and A must be duration arrays.
duration: M = mean (D)
duration: M = mean (D, dim)
duration: M = mean (D, vecdim)
duration: M = mean (D, 'all')
duration: M = mean (…, nanflag)
duration: M = mean (…, outtype)
duration: M = mean (…, 'Weights', W)
This method overloads the core mean function for duration arrays.
The functionality is identical to core mean function.
Type help mean for more information.
duration: M = median (D)
duration: M = median (D, dim)
duration: M = median (D, vecdim)
duration: M = median (D, 'all')
duration: M = median (…, nanflag)
duration: M = median (…, outtype)
This method overloads the core median function for duration
arrays. The functionality is identical to core median function.
Type help median for more information.
duration: M = mode (D)
duration: M = mode (D, dim)
duration: M = mode (D, vecdim)
duration: M = mode (D, 'all')
duration: [M, F, C] = mode (…)
This method overloads the core mode function for duration arrays.
The functionality is identical to core mode function.
Type help mode for more information.
duration: Q = prctile (D)
duration: q = prctile (D, p)
duration: Q = prctile (D, p, dim)
duration: Q = prctile (D, p, vecdim)
duration: Q = prctile (D, p, 'all')
duration: Q = prctile (D, p, …, method)
This method overloads the core prctile function for duration
arrays. The functionality is identical to core prctile function.
Type help prctile for more information.
duration: Q = quantile (D)
duration: Q = quantile (D, p)
duration: Q = quantile (D, n)
duration: Q = quantile (D, …, dim)
duration: Q = quantile (D, …, vecdim)
duration: Q = quantile (D, …, 'all')
duration: Q = quantile (D, p, …, method)
duration: Q = quantile (D, n, …, method)
This method overloads the core quantile function for duration
arrays. The functionality is identical to core quantile function.
Type help quantile for more information.
duration: R = range (D)
duration: R = range (D, dim)
duration: R = range (D, vecdim)
duration: R = range (D, 'all')
duration: R = range (…, nanflag)
This method overloads the core range function for duration arrays.
The functionality is identical to core range function.
Type help range for more information.
duration: E = rmse (F, A)
duration: E = rmse (F, A, dim)
duration: E = rmse (F, A, vecdim)
duration: E = rmse (F, A, 'all')
duration: E = rmse (…, nanflag)
duration: E = rmse (…, 'Weights', W)
This method overloads the core rmse function for duration arrays.
The functionality is identical to core rmse function.
Type help rmse for more information.
duration: y = skewness (D)
duration: y = skewness (D, flag)
duration: y = skewness (D, flag, dim)
duration: y = skewness (D, flag, vecdim)
duration: y = skewness (D, flag, 'all')
This method overloads the core skewness function for duration
arrays. The functionality is identical to core skewness function.
Type help skewness for more information.
Note that skewness is a dimensionless quantity Thus, the returned argument is a numeric array of double type and not a duration array.
duration: S = std (D)
duration: S = std (D, w)
duration: S = std (D, w, dim)
duration: S = std (D, w, vecdim)
duration: S = std (D, w, 'all')
duration: S = std (…, nanflag)
duration: [S, M] = std (…)
This method overloads the core std function for duration arrays.
The functionality is identical to core std function.
Type help std for more information.
duration: B = sort (A)
duration: B = sort (A, dim)
duration: B = sort (A, direction)
duration: B = sort (A, dim, direction)
duration: B = sort (…, 'MissingPlacement', MP)
duration: B = sort (…, 'ComparisonMethod', CM)
duration: [B, index] = sort (A, …)
B = sort (A) sorts the duration array A in
ascending order. If A is a matrix, sort (A) sorts
each column of A in ascending order. For multidimensional arrays,
mode (A) sorts along the first non-singleton dimension.
B = sort (A, dim) sorts along the dimension
specified by dim.
B = sort (A, direction) also specifies the
sorting direction, which can be either 'ascend' (default) or
'descend'.
B = sort (…,
specifies where to place the missing elements ('MissingPlacement', MP)<undefined>)
returned in B with one of the following options specified in
MP:
'auto', which is the default, places missing elements last
for ascending sort and first for descending sort.
'first' places missing elements first.
'last' places missing elements last.
B = sort (…,
specifies the comparison method for determining the order of elements
returned in B with one of following options:
'ComparisonMethod', CM)
'auto', which is the default, sorts by real (A).
'real' sorts by real (A).
'abs' sorts by abs (A).
[B, index] = sort (A, …) also returns a
sorting index containing the original indices of the elements in the
sorted array. index is the same size as A and it comprises
indexing vectors oriented along the operating dimensions.
B = A(index).
dim = 1, then
index contains the original row indices of the elements in the
sorted vector B such that for j = 1:N,
B(:,j) = A(index(:,j),j).
duration: B = sortrows (A)
duration: B = sortrows (A, col)
duration: B = sortrows (A, direction)
duration: B = sortrows (A, col, direction)
duration: B = sortrows (…, 'MissingPlacement', MP)
duration: [B, index] = sortrows (A, …)
B = sortrows (A) sorts the rows of the 2-D duration
array A in ascending order. The sorted array B has the same
size as A.
B = sortrows (A, col) sorts A according to
to the columns specified by the numeric vector col, which must
explicitly contain non-zero integers whose absolute values index existing
columns in A. Positive elements sort the corresponding columns in
ascending order, while negative elements sort the corresponding columns
in descending order.
B = sortrows (A, direction) also specifies the
sorting direction, which can be either 'ascend' (default) or
'descend' applying to all columns in A. Alternatively,
direction can be either a string array or a cell array of character
vectors specifying the sorting direction for each individual column of
A, in which case the number of elements in direction must
equal the number of columns in A.
B = sortrows (A, col, direction) sorts the
categorical array A according to the columns specified in col
using the corresponding sorting direction specified in direction.
In this case, the sign of the values in col is ignored. col
and direction must have the same number of elements, but not
necessarily equal to the columns of A.
B = sortrows (…,
specifies where to place the missing elements ('MissingPlacement', MP)NaN) returned in
B with any of the following options specified in MP:
'auto', which is the default, places missing elements last
for ascending sort and first for descending sort.
'first' places missing elements first.
'last' places missing elements last.
[B, index] = sortrows (A, …) also returns
an index vector containing the original row indices of A in the
sorted matrix B such that B = A(index,:).
duration: B = unique (A)
duration: B = unique (A, setOrder)
duration: B = unique (A, occurrence)
duration: B = unique (A, setOrder, occurrence)
duration: B = unique (A, occurrence, setOrder)
duration: B = unique (A, …, 'rows')
duration: [B, ixA, ixB] = unique (…)
B = unique (A) returns the unique values of the
duration array A in sorted order.
B = unique (A, setOrder) returns the unique
values of the duration array A in an order as specified by
setOrder, which can be either of the following values:
'sorted' (default) returns the unique values sorted in
ascending order.
'stable' returns the unique values according to their order
of occurrence.
B = unique (A, occurrence) returns the unique
values of the duration array tblA according to their order of
occurrence. occurrence can be either of the following values:
'first' (default) returns the first occurrence of each
unique value, i.e. the lowest possible indices are returned.
'last' returns the last occurrence of each unique value,
i.e. the highest possible indices are returned.
You can specify setOrder and occurrence arguments together.
B = unique (A, …, returns the
unique rows of A by treating each row as a single entity. The
'rows')'rows' option can be used alone or in any combination with the
setOrder and occurrence arguments. 'rows' can be
placed at any position in the function’s argument list after the input
array A. However, this syntax is only valid for 2-dimensional
duration arrays.
[tblB, ixA, ixB] = unique (…) also returns
index vectors ixA and ixB using any of the previous syntaxes.
ixA and ixB map the arrays A and B to one another
such that B = A(ixA) and
A = B(ixB). When the 'rows' optional
argument is specified, then B = A(ixA,:) and
tblA = tblB(ixB,:).
duration: YI = interp1 (X, Y, XI)
duration: YI = interp1 (Y, XI)
duration: YI = interp1 (…, method)
duration: YI = interp1 (…, method, extrapolation)
duration: pp = interp1 (X, Y, 'pp')
duration: pp = interp1 (X, Y, method, 'pp')
YI = interp1 (X, Y, XI) computes the
linearly interpolated values of a one-dimensional function, which is
represented by sample points X and corresponding values Y,
at specific query points XI. X must be a vector. If Y
is vector, then it must have the same length as X. If Y is
matrix, then each column is treated as a different set of one-dimensional
sample values and the number of rows must equal the length of X.
XI must be a vector and the same data type as X. The output
XI is the same data type as Y and its size depends on Y
and XI. X and Y can both be duration arrays or one of
them can be a numeric array.
YI = interp1 (Y, XI) computes the linearly
interpolated values of a one-dimensional function assuming a default set
of sampling points determined by the shape of Y:
[1:length(Y).
[1:size(Y).
YI = interp1 (…, method) specifies one of the
following interpolation methods to be used:
'linear' (default) computes the linear interpolation from
nearest neighbors.
'nearest' returns the nearest neighbor.
'next' returns the next neighbor.
'previous' returns the previous neighbor.
'pchip' computes the piecewise cubic Hermite interpolating
polynomial, which corresponds to shape-preserving interpolation with
smooth first derivative.
'cubic' computes the cubic interpolation.
'spline' computes the cubic spline interpolation, which
corresponds to smooth first and second derivatives throughout the curve.
YI = interp1 (…, method, extrapolation)
further specifies a strategy for evaluating points that lie outside the
range of the sample points in X. Set extrapolation to
'extrap' to use the current method to extrapolate values.
Set extrapolation to a scalar value of the same data type as
Y to return a constant value outside the range of X. When
unspecified, extrapolation defaults to NaN.
pp = interp1 (X, Y, returns a
piecewise polynomial object, using the default linear interpolation
algorithm, which can be later used with 'pp'ppval to evaluate the
interpolation at new query points.
pp = interp1 (X, Y, method,
return a piecewise polynomial object, using the interpolation algorithm
specified by method, which can be later used with 'pp'ppval to
evaluate the interpolation at new query points.
duration: C = intersect (A, B)
duration: C = intersect (A, B, 'rows')
duration: C = intersect (A, B, …, order)
duration: [C, ixA, ixB] = intersect (…)
C = intersect (A, B) returns the unique common
values of the duration arrays A and B. Either A or
B input arguments can also be a duration string specified as a
character vector, a string array, or a cell array of character vectors,
or a numeric array representing 24-hour days. In such case, the input is
promoted to a duration array prior to calculating the intersection. If
both A and B are row vectors, then C is also a row
vector, otherwise intersect returns a column vector.
C = intersect (A, B, returns the
unique common rows of the duration matrices A and B, which
must have the same number of columns. By default, the rows in duration
matrix C are in sorted order.
'rows'
… = intersect (A, B, …, order) also
specifies the order of the returned unique values. order can be
'sorted', which is the default behavior, or 'stable', in
which case the unique values are returned in order of appearance.
[C, ixA, ixB] = intersect (…) also returns
index vectors ixA and ixB such that
C = A(ixA) and
C = B(ixB), unless the 'rows' optional
argument is given, in which case C = A(ixA,:)
and C = B(ixB,:).
duration: C = setdiff (A, B)
duration: C = setdiff (A, B, 'rows')
duration: C = setdiff (A, B, …, order)
duration: [C, ixA] = setdiff (…)
C = setdiff (A, B) returns the unique common
values of the duration arrays A and B. Either A or
B input arguments can also be a duration string specified as a
character vector, a string array, or a cell array of character vectors,
or a numeric array representing 24-hour days. In such case, the input is
promoted to a duration array prior to calculating the intersection. If
both A and B are row vectors, then C is also a row
vector, otherwise intersect returns a column vector.
C = setdiff (A, B, returns the
unique common rows of the duration matrices A and B, which
must have the same number of columns. By default, the rows in duration
matrix C are in sorted order.
'rows'
… = setdiff (A, B, …, order) also
specifies the order of the returned unique values. order can be
'sorted', which is the default behavior, or 'stable', in
which case the unique values are returned in order of appearance.
[C, ixA] = setdiff (…) also returns the index
vector ixA such that C = A(ixA), unless
the 'rows' optional argument is given, in which case
C = A(ixA,:).
duration: C = setxor (A, B)
duration: C = setxor (A, B, 'rows')
duration: C = setxor (A, B, …, order)
duration: [C, ixA, ixB] = setxor (…)
C = setxor (A, B) returns the unique common
values of the duration arrays A and B. Either A or
B input arguments can also be a duration string specified as a
character vector, a string array, or a cell array of character vectors,
or a numeric array representing 24-hour days. In such case, the input is
promoted to a duration array prior to calculating the intersection. If
both A and B are row vectors, then C is also a row
vector, otherwise intersect returns a column vector.
C = setxor (A, B, returns the
unique common rows of the duration matrices A and B, which
must have the same number of columns. By default, the rows in
duration matrix C are in sorted order.
'rows'
… = setxor (A, B, …, order) also
specifies the order of the returned unique values. order can be
'sorted', which is the default behavior, or 'stable', in
which case the unique values are returned in order of appearance.
[C, ixA, ixB] = setxor (…) also returns
index vectors ixA and ixB such that
C = A(ixA) and
C = B(ixB), unless the 'rows' optional
argument is given, in which case C = A(ixA,:)
and C = B(ixB,:).
duration: C = union (A, B)
duration: C = union (A, B, 'rows')
duration: C = union (A, B, …, order)
duration: [C, ixA, ixB] = union (…)
C = union (A, B) returns the unique common
values of the duration arrays A and B. Either A or
B input arguments can also be a duration string specified as a
character vector, a string array, or a cell array of character vectors,
or a numeric array representing 24-hour days. In such case, the input is
promoted to a duration array prior to calculating the intersection. If
both A and B are row vectors, then C is also a row
vector, otherwise intersect returns a column vector.
C = union (A, B, returns the
unique common rows of the duration matrices A and B, which
must have the same number of columns. By default, the rows in
duration matrix C are in sorted order.
'rows'
… = union (A, B, …, order) also
specifies the order of the returned unique values. order can be
'sorted', which is the default behavior, or 'stable', in
which case the unique values are returned in order of appearance.
[C, ixA, ixB] = union (…) also returns
index vectors ixA and ixB such that
C = A(ixA) and
C = B(ixB), unless the 'rows' optional
argument is given, in which case C = A(ixA,:)
and C = B(ixB,:).
duration: C = cat (dim, A, B, …)
C = cat (dim, A, B, …) concatenates
duration arrays A, B, … along dimension dim. All
input arrays must have the same size except along the operating dimension
dim. Any of the input arrays may also be string arrays or cell
arrays of character vectors of compatible size. Additionally, an input
can be a numeric matrix, which when parsed to the constructor will return
a duration array of compatible size.
duration: C = horzcat (A, B, …)
C = horzcat (A, B, … is the equivalent of
the syntax B = [A, B, …] and horizontally
concatenates the duration arrays A, B, …. All input
arrays must have the same size except along the second dimension. Any of
the input arrays may also be string arrays or cell arrays of character
vectors of compatible size. Additionally, an input can be a numeric
matrix, which when parsed to the constructor will return a duration array
of compatible size.
duration: C = vertcat (A, B, …)
C = vertcat (A, B, … is the equivalent of
the syntax B = [A; B; …] and vertically
concatenates the duration arrays A, B, …. All input
arrays must have the same size except along the first dimension. All of
the input arrays may also be string arrays or cell arrays of character
vectors of compatible size. Additionally, an input can be a numeric
matrix, which when parsed to the constructor will return a duration array
of compatible size.
duration: B = repmat (A, n)
duration: B = repmat (A, d1, …, dN)
duration: B = repmat (A, dimvec)
B = repmat (A, n) returns a duration array
B containing n copies of the input duration array A
along every dimension of A.
B = repmat (A, d1, …, dN) returns an
array B containing copies of A along the dimensions specified
by the list of scalar integer values d1, …, dN, which
specify how many copies of A are made in each dimension.
B = repmat (A, dimvec) is equivalent to the
previous syntax with dimvec = [d1, …, dN].
duration: B = repelem (A, n)
duration: B = repelem (A, d1, …, dN)
B = repelem (A, n) returns a duration vector
B containing repeated elements of the input A, which must be
a duration vector. If n is a scalar, each element of A is
repeated n times along the non-singleton dimension of A. If
n is a vector, it must have the same elements as A, in which
case it specifies the number of times to repeat each corresponding
element of A.
B = repelem (A, d1, …, dN returns
an array B with each element of A repeated according to the
the list of input arguments d1, …, dN each
corresponding to a different dimension 1:ndims (A) of the
input array A. d1, …, dN must be either scalars
or vectors with the same length as the corresponding dimension of
A containing non-negative integer values specifying the number of
repetitions of each element along the corresponding dimension.
duration: B = repelems (A, R)
B = repelems (A, R) returns a duration vector
B containing repeated elements of the input A, which must be
a duration vector. R must be a matrix of integers.
Entries in the first row of R correspond to the linear indexing of
the elements in A to be repeated. The corresponding entries in the
second row of R specify the repeat count of each element.
duration: B = reshape (A, d1, …, dN)
duration: B = reshape (A, …, [], …)
duration: B = reshape (A, dimvec)
B = reshape (A, d1, …, dN) returns a
duration array B with specified dimensions d1, …,
dN, whose elements are taken columnwise from the duration array
A. The product of d1, …, dN must equal the total
number of elements in A.
B = reshape (A, …, returns
a duration array B with one dimension unspecified which is
calculated automatically so that the product of dimensions in B
matches the total elements in A, which must be divisible the
product of specified dimensions. An empty matrix [], …)([]) is used to
flag the unspecified dimension.
duration: B = circshift (A, n)
duration: B = circshift (A, n, dim)
B = circshift (A, n) circularly shifts the
elements of the duration array A according to n. If n
is a nonzero integer scalar, then the elements of A are shifted by
n elements along the first non-singleton dimension of A. If
n is a vector, it must not be longer that the number of dimensions
of A with each value of n corresponding to a dimension in
A. The sign of the value(s) in n specify the direction in
the elements of A are shifted.
B = circshift (A, n, dim) circularly
shifts the elements of the duration array A along the dimension
specified by dim. In this case, n must be a scalar integer
value.
duration: B = permute (A, dims)
B = permute (A, dims) returns the generalized
transpose of the duration array A by rearranging its dimensions
according to the permutation vector specified in dims.
dims must index all the dimensions 1:ndims (A) of the
input array A, in any order, but only once. The Nth
dimension of A gets remapped to the dimension in B specified
by dims(N).
duration: A = ipermute (B, dims)
A = ipermute (B, dims) returns the inverse of
the generalized transpose performed by the permute function. The
expression ipermute (permute (A, dims), dims)
returns the original array A.
dims must index all the dimensions 1:ndims (B) of the
input array B, in any order, but only once. The dimension of
B specified in dims(N) gets remapped to the
Nth dimension of A.
duration: B = transpose (A)
B = transpose (A) is the equivalent of the syntax
B = A.' and returns the transpose of the duration
matrix A.
duration: B = ctranspose (A)
B = ctranspose (A) is the equivalent of the syntax
B = A' and returns the transpose of the duration
matrix A. For duration arrays, ctranspose is identical to
transpose.