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

    %% Split Calendar Duration Array   
%% 
% Create a |calendarDuration| array. 
T = calmonths(15:17) + caldays(8) + hours(1.2345)  

%% 
% Get the month, day, and time. 
[m,d,t] = split(T,{'months','days','time'})  

%% 
% Get the year, month, day, and time.
[y,m,d,t] = split(T,{'years','months','days','time'}) 

%%
% When you request both the year and month, |split| carries over
% month values greater than 12 to the year value.