aggregate data of a dataset

조회 수: 4 (최근 30일)
Megan
Megan 2020년 2월 16일
편집: Megan 2020년 2월 19일
Hi guys how can I aggregate data vom my dataset array?

채택된 답변

Sindar
Sindar 2020년 2월 16일
check out splitapply. You may need to change the format of your data, but it does exactly what you want:
G = findgroups(ds.seats);
mean_dist = splitapply(@mean,ds.score,G);
Switching to tables is probably a good idea:
ds = readtable("datasetT.csv");
  댓글 수: 17
Megan
Megan 2020년 2월 16일
That worked out well Thanks!!!
One last question: now I have two rows with mean values.
How can I know which row is which seat number?
Sindar
Sindar 2020년 2월 16일
Look at the second output from findgroups:
[G,G_seat] = findgroups(clean_ds.Seat);
At the end, you can make a summary table:
sum_table = table(G_seat,mean_dist)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Tables에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by