Categories &

Functions List

Class Definition: calendarDuration

datatypes: calendarDuration

Array representing durations of time using flexible-length calendar date/time units.

Each calendarDuration element stores internally the number of whole months, the number of whole days, and a duration object representing hours, minutes, and seconds. It can be used to simplify calculations on datetime arrays involving calendar units.

calendarDuration arrays can be created through their constructor by combining numeric arrays representing individual calendar duration units or through the functions caldays, calweeks, calmonths, calquarters, and calyears, which create calendar durations in terms of a single calendar duration unit. These functions are also available as methods of calendarDuration arrays to extract individual calendar duration units as numeric arrays.

See also: datetime, duration

Source Code: calendarDuration

The calendarDuration class contains the following properties:

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.

The calendarDuration class offers the following public methods:

calendarDuration Create a new array of calendar durations.
dispstrings Get display formatted strings for each element of a calendarDuration array.
cellstr Convert calendarDuration array to a cell array of character vectors.
char Convert calendarDuration array to a character matrix.
datevec Convert calendarDuration array to date vectors.
time Return time portion of calendarDuration array.
split Split calendarDuration array into numeric and duration units.
caldays Calendar duration in days.
calweeks Calendar duration in weeks.
calmonths Calendar duration in months.
calquarters Calendar duration in quarters.
calyears Calendar duration in years.
size Size of a calendarDuration array.
ndims Number of dimensions in a calendarDuration array.
numel Total number of elements in a calendarDuration array.
nnz Number of nonzero elements in calendarDuration array.
length Length of a calendarDuration vector.
keyHash Generate a hash code for a calendarDuration array.
iscolumn Return true if calendarDuration array is a column vector.
isempty Return true if calendarDuration array is empty.
isequal Return true if calendarDuration arrays are equal.
isequaln Return true if calendarDuration arrays are equal under the assumption that missing elements are equal.
isfinite Return true for calendar durations that are finite.
isinf Return true for calendar durations that are infinite.
ismatrix Return true if calendarDuration array is a 2-D array.
ismissing Find missing data in a calendarDuration array.
isnan Return true for calendar durations that are Not-A-Number.
isreal Always return true for calendarDuration arrays.
isrow Return true if calendarDuration array is a row vector.
isscalar Return true if calendarDuration array is a scalar.
isvector Return true if calendarDuration array is a vector.
minus Subtraction for calendarDuration arrays.
uminus Unary minus for calendarDuration arrays.
plus Addition for calendarDuration arrays.
uplus Unary plus for calendarDuration arrays.
times Element-by-element multiplication for calendarDuration arrays.
mtimes Matrix multiplication for calendarDuration arrays.
eq Test for equality between calendarDuration arrays.
ne Test for inequality between calendarDuration arrays.
unique Unique values in a calendarDuration array.
cat Concatenate calendarDuration arrays.
horzcat Horizontal concatenation of calendarDuration arrays.
vertcat Vertical concatenation of calendarDuration arrays.
repmat Repeat copies of a calendarDuration array.
repelem Repeat copies of calendarDuration array elements.
repelems Construct a vector of repeated elements from a calendarDuration array.
reshape Reshape calendarDuration array.
circshift Circularly shift the elements in a calendarDuration array.
permute Generalized transpose for a calendarDuration N-D array.
ipermute Inverse of the generalized transpose for a calendarDuration N-D array.
transpose Transpose a calendarDuration matrix.
ctranspose Transpose a calendarDuration matrix.