Adding cell array values across column

1 次查看(过去 30 天)
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?

采纳的回答

Rik
Rik 2020-8-23
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);

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Data Types 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by