suppose I have a table S
date income----------------------------1/1/2020 1001/2/2020 20
I want to create a table T of mean of income at each month like
month income average----------------------------1/2020 502/2020 20
So is it that I first create
T.yyyyMM=datetime(S.date, 'InputFormat','MM/dd/yyyy', 'Format','yyyyMM');
then use
T.accumarray(T.yyyyMM,S.income,[],@mean)
Does it make sense?
Best Answer