Adding cell array values across column

1 vue (au cours des 30 derniers jours)
AA
AA le 23 Août 2020
Réponse apportée : Rik le 23 Août 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?

Réponse acceptée

Rik
Rik le 23 Août 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);

Plus de réponses (0)

Catégories

En savoir plus sur Matrices and Arrays dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by