Summing up rows of a cell containing 3D matrices

1 Ansicht (letzte 30 Tage)
maubars
maubars am 19 Jan. 2021
Kommentiert: maubars am 20 Jan. 2021
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}

Akzeptierte Antwort

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

Weitere Antworten (0)

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Produkte


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by