Summing up rows of a cell containing 3D matrices

2 次查看(过去 30 天)
I wish to sum all rows of a cell below containing 3D arrays to obtain a cell summations as seen below and to further concatate the columns into a 3D array. I Please assist.
Cell =
5×5 cell array
{30×30×30 double} {30×30×30 double} {30×30×30 double} {30×30×30 double} {30×30×30 double}
{30×30×30 double} {30×30×30 double} {30×30×30 double} {30×30×30 double} {30×30×30 double}
{30×30×30 double} {30×30×30 double} {30×30×30 double} {30×30×30 double} {30×30×30 double}
{30×30×30 double} {30×30×30 double} {30×30×30 double} {30×30×30 double} {30×30×30 double}
{30×30×30 double} {30×30×30 double} {30×30×30 double} {30×30×30 double} {30×30×30 double}
% Sum rows to get the below cell summation
Cell_Summation =
1×5 cell array
{30×30×30 double} {30×30×30 double} {30×30×30 double} {30×30×30 double} {30×30×30 double}
% Concatate the columns to get the below final cell summation in the x axis or even better an a array
Final_Cell_Summation =
1×1 cell array % or array
{30×150×30 double}

采纳的回答

Matt J
Matt J 2021-1-19
C=reshape( cat(2,Cell{:}) ,[30,30,5,5,30]);
Final=reshape( sum(C,3) , 30,150,30);

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

标签

产品


版本

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by