take averages of obvervations for each month
Afficher commentaires plus anciens
suppose I have a table S
date income
----------------------------
1/1/2020 100
1/2/2020 20
I want to create a table T of mean of income at each month like
month income average
----------------------------
1/2020 50
2/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?
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Timetables dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!