How do I average a 5-dimensional array?
1 次查看(过去 30 天)
显示 更早的评论
Hi All,
I have a 5-D array that is 244 x 16 x 10 x 4 x 5, the '244 x 16' is data collected over time; the '10' is the number of trials; the '4' is number of experiments and the '5' is the number of participants. In other words, for every participant, I conducted 4 experiments, where I collected 10 trials of 244 x 16 data.
I would like to mean the number of trials for every experiment per participant, though I am having difficulty doing this. I have tried:
m = squeeze(mean(data,3)) %data is 244x16x10x4x5
However, when I plot the data (244 x 16) using a nested for loop (to plot per participant per experiment), my plots look completely off, suggesting that I may have averaged the data incorrectly.
Can someone please advise me if I have averaged my data incorrectly (I am assuming that I have)?
Thank you in advance
6 个评论
Bruno Luong
2020-8-15
One thing I would suggest is do not use SQUEEZE command, since you might find SQUEEZE does something you won't expect if one of dimension become scalar and you don't anticipate that to happens.
Use RESHAPE.
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!