Group and individual means

1 回表示 (過去 30 日間)
Liz Mat
Liz Mat 2019 年 7 月 9 日
コメント済み: Liz Mat 2019 年 7 月 12 日
I have a dataset of kinematic angular values. Each row representing 100 datapoints of angular data (Y). I have a column vector containing my subject numbers (1-9) and another column vector indicating three different conditions (A).
I am able to calculate the group mean for each
YS1 = Y(Sub==1)
SubMean = mean (Y1S)
(All conditions, 1 subject)
Same for condition mean
YA1 = Y(A==1)
SubMean = mean (YA1)
(All subjects, 1 condition)
How can I combine it to to get the mean for 1 subject AND 1 condition - Thus (Sub==1) AND (A==1)

採用された回答

per isakson
per isakson 2019 年 7 月 9 日
Try this
YSA1 = Y(Sub==1&A==1);
SubMean = mean (YSA1);
  3 件のコメント
per isakson
per isakson 2019 年 7 月 10 日
Replace
YSA1 = Y(SUBJ==1,: & A==32,:);
by
YSA1 = Y( SUBJ==1 & A==32 );
i.e. remove the commas and the colons. See my answer
Liz Mat
Liz Mat 2019 年 7 月 12 日
Thank you!

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

その他の回答 (1 件)

Liz Mat
Liz Mat 2019 年 7 月 10 日
I managed to get it working:
SA1 = (Sub==1)&(A==1);
YSA1 = Y(SA1,:);
SubMean = mean (YSA1);
It might be bit lengthy though.
  1 件のコメント
per isakson
per isakson 2019 年 7 月 10 日
The parentheses in SA1 = (Sub==1)&(A==1); are not needed.

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

カテゴリ

Help Center および File ExchangeParticle & Nuclear Physics についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by