How to extract elements from cell arrays and compute the mean of those elements?
1 次查看(过去 30 天)
显示 更早的评论
Hello,
I have a 1x11 cell array. Each element in the array is 128 x 1000 matrix (see figure). How can I extract the [9 10 11 12 13 28 29 30 31 32 33 34] from each element and compute the mean of these elements, so that the resultant element will be the mean[9 10 11 12 13 28 29 30 31 32 33 34] x1000 (i.e. 1x1000) in each of the 1x11 cell array. Thanks,
0 个评论
采纳的回答
Rik
2021-12-9
By far the easiest way is to use a loop.
SubB_M1power={rand(128,3),rand(128,3)};
for n=1:numel(SubB_M1power)
SubB_M1power{n}=mean(SubB_M1power{n},1);
end
SubB_M1power
5 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!