www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/GroupDatetimeDataByMonthExample.m
%% Group Datetime Data by Month % Create a 10-by-1 datetime vector with random dates in the year 2016. % Then, group the datetime values by month and return the result as a % categorical array. X = datetime(2016,1,randi(365,10,1)) %% Y = discretize(X,'month','categorical')