Group-wise mean in multi-dimentional array
显示 更早的评论
I have a cell array of the dimension 1 x 121 x 515. It represents 515 sets of 1 x 121 frequency data. Since every 5 sets (along the 515) belongs in a group, I would like to take the element-wise mean of the frequency data every 5 sets (along the 515 axis). In other words, averaging the frequency data for each group so the final output will be 1x121x103. How should I do so? I tried to use the reshape feature to turn my array into 5 x 121 x 103, but the result transformation is incorrect when I compare the numbers in the pre- and post- transformed numbers.
Here is what I did:
O_npsaverageAirT=reshape(npsaverageAir,5,121,103);
I believe I can use the following to take my group-wise mean once the previous step is worked out. Is that right?
O_npsaverageAir=mean(O_npsaverageAirT,1);
I similarly have a 256*256*515 array that needs the same "average-every-5" operation along the 515-axis. I believe the solution should be similar to this one?
Thanks so much!
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Data Type Conversion 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!