caldiff
Calendar math successive differences
Description
calculates time differences between adjacent datetime values in dt
= caldiff(t
)t
in terms of the calendar components years, months, days, and time.
caldiff
calculates differences along the first array
dimension whose size does not equal 1.
If
t
is a vector of lengthm
, thendt = caldiff(t)
returns a vector of lengthm-1
. The elements ofdt
are the differences between adjacent elements oft
.dt = [between(t(1),t(2)), between(t(2),t(3)),..., between(t(m-1),t(m))]
If
t
is a nonvectorp
-by-m
matrix, thendt = caldiff(t)
returns a matrix of size(p-1)
-by-m
, whose elements are the differences between the rows oft
.dt(:,I) = [between(t(1,I),t(2,I), between(t(2,I),t(3,I)), ...,
between(t(p-1,I),t(p,I))]
finds the differences between successive datetimes in dt
= caldiff(t
,components
)t
in terms
of the specified calendar or time components.
finds the differences between successive datetimes along the dimension specified by
dt
= caldiff(t
,components
,dim
)dim
.
Examples
Input Arguments
Output Arguments
Tips
To compute successive differences between datetimes in
t1
andt2
as exact, fixed-length units of hours, minutes, and seconds, usediff(t)
.
Extended Capabilities
Version History
Introduced in R2014b
See Also
diff
| between
| calendarDuration
| minus