Find average of of rows across various conditional columns

1 回表示 (過去 30 日間)
Tanaya Chatterjee
Tanaya Chatterjee 2021 年 11 月 8 日
コメント済み: Adam Danz 2021 年 11 月 18 日
I have a datasets for each participants where there are 7 columns as shown below.
TRIAL X Y dist_loc_code dist_type_code soa_code sacc_amp
20 968,20 512,40 1 3 1 10,09
22 968,00 528,90 1 3 1 5,83
22 943,90 772,50 1 3 1 4,61
33 989,00 520,20 1 3 1 5,77
First, I want to sort the data for each according to the condtions: dist_loc_code, dist_type_code and soa_code.
Then, I want to average the sacc_amp of each of the combination of the conditons across rows.
  3 件のコメント
Tanaya Chatterjee
Tanaya Chatterjee 2021 年 11 月 18 日
編集済み: Tanaya Chatterjee 2021 年 11 月 18 日
It was a numeric matrix.
And thank you for your help.
I tried the following codes using Matlab documentations and examples. This worked for me!
Raw = readmatrix ( 'Raw_Subj.xlsx', 'Sheet', 'Sheet1') % load the xlsx file as a matrix, 'Sheet1' spreadsheet
[K, ~, G] = unique(Raw(:, 4:6), 'rows'); %find unique condition combo for 4,5,6th columns)
sacamp = [K, accumarray(G,Raw(:, 7), [], @mean)] %for each unique combo, find mean of sacc amp
Adam Danz
Adam Danz 2021 年 11 月 18 日
This looks like it could be helpful but you'd need to attach the Raw_Subj file for us to look at and play around with the table.

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeData Import and Analysis についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by