years
Duration in years
Syntax
Description
Y = years(
returns an array of fixed-length years
equivalent to the values in the input array.X
)
If
X
is a numeric array, thenY
is aduration
array in units of fixed-length years. A fixed-length year is equal to 365.2425 days.If
X
is aduration
array, thenY
is adouble
array with each element equal to the number of fixed-length years in the corresponding element ofX
.
The years
function converts between duration
and double
values.
To display a duration in units of years, set its Format
property
to 'y'
.
Leap years have one extra day. To create an array of calendar years that
account for leap years when used in calendar calculations, use the
calyears
function.
Examples
Input Arguments
Extended Capabilities
Version History
Introduced in R2014b