www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/ConvertCalendarDurationsToCalendarYearsExample.m

    %% Convert Calendar Durations to Calendar Years
% Create an array of calendar durations. Then, convert each value to the
% equivalent number of whole calendar years.

% Copyright 2015 The MathWorks, Inc.

X = calmonths(21:25) + caldays(8)
%%
Y = calyears(X)