Adding cell array values across column

1 Ansicht (letzte 30 Tage)
AA
AA am 23 Aug. 2020
Beantwortet: Rik am 23 Aug. 2020
Columns 1
[ 7.669142585357160e-04]
[-1.206232786783515e-04]
[ 8.630787019556518e-04]
[-2.445883525841570e-05]
[ 9.109657363289406e-04]
Columns 2 through 4
[-1.206232786783515e-04] [3.231454899286823e-04] [150]
[ 0.001808452047926] [8.439143846238298e-04] [-40]
[-2.445883525841570e-05] [4.193099333486180e-04] [170]
[ 9.109657363289406e-04] [4.432534505352624e-04] [-20]
[-6.645138877833179e-04] [1.232259242728113e-04] [180]
Suppose I have the above cell array above. How can I get the sum of each cell array column when adding the values across the column?

Akzeptierte Antwort

Rik
Rik am 23 Aug. 2020
It looks like you can simply convert to a normal matrix (and back):
A={your_cell};
A=cell2mat(A);
A=sum(A,1);
A=num2cell(A);

Weitere Antworten (0)

Kategorien

Mehr zu Matrices and Arrays finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by