How to find the mean of categorical data

6 ビュー (過去 30 日間)
Isabelle Lowson
Isabelle Lowson 2020 年 2 月 11 日
回答済み: Sindar 2020 年 2 月 12 日
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 件のコメント
JESUS DAVID ARIZA ROYETH
JESUS DAVID ARIZA ROYETH 2020 年 2 月 11 日
can you give us an example with code please?

サインインしてコメントする。

回答 (1 件)

Sindar
Sindar 2020 年 2 月 12 日
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);

カテゴリ

Help Center および File ExchangeDates and Time についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by