How to find the mean of categorical data

6 vues (au cours des 30 derniers jours)
Isabelle Lowson
Isabelle Lowson le 11 Fév 2020
Réponse apportée : Sindar le 12 Fév 2020
How can I find the mean distance travelled on each day of the week over a certain period of time. I have the distance travelled for each day but need to find the mean for each week day.
  1 commentaire
JESUS DAVID ARIZA ROYETH
JESUS DAVID ARIZA ROYETH le 11 Fév 2020
can you give us an example with code please?

Connectez-vous pour commenter.

Réponses (1)

Sindar
Sindar le 12 Fév 2020
check out splitapply. You may need to change the format of your data, but it does exactly what you want:
G = findgroups(Day);
mean_dist = splitapply(@mean,distance,G);

Catégories

En savoir plus sur Dates and Time dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by