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
tis a vector of lengthm, thendt = caldiff(t)returns a vector of lengthm-1. The elements ofdtare the differences between adjacent elements oft.dt = [between(t(1),t(2)), between(t(2),t(3)),..., between(t(m-1),t(m))]
If
tis a nonvectorp-by-mmatrix, 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
t1andt2as exact, fixed-length units of hours, minutes, and seconds, usediff(t).
Extended Capabilities
Version History
Introduced in R2014b
See Also
diff | between | calendarDuration | minus