Adding cell array values across column

1 visualización (últimos 30 días)
AA
AA el 23 de Ag. de 2020
Respondida: Rik el 23 de Ag. de 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?

Respuesta aceptada

Rik
Rik el 23 de Ag. de 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);

Más respuestas (0)

Categorías

Más información sobre Data Types en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by