# 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 length`m`

, then`dt = caldiff(t)`

returns a vector of length`m-1`

. The elements of`dt`

are the differences between adjacent elements of`t`

.dt = [between(t(1),t(2)), between(t(2),t(3)),..., between(t(m-1),t(m))]

If

`t`

is a nonvector`p`

-by-`m`

matrix, then`dt = caldiff(t)`

returns a matrix of size`(p-1)`

-by-`m`

, whose elements are the differences between the rows of`t`

.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`

and`t2`

as exact, fixed-length units of hours, minutes, and seconds, use`diff(t)`

.

## Extended Capabilities

## See Also

`diff`

| `between`

| `calendarDuration`

| `minus`

**Introduced in R2014b**