Sum of specific row of all the coulumns

1 次查看(过去 30 天)
I am trying to get the totals in row 7 for all the columns (marked in red).

采纳的回答

Ameer Hamza
Ameer Hamza 2020-5-16
Run this example
t = {'row1', 100, 20, 35;
'row2', 200, 13, 34;
'row3', 450, 24, 24;
'row4', 20, 12, 10};
t = cell2table(t);
t{end+1,2:end} = sum(t{:,2:end})

更多回答(1 个)

Milosha Britto Nordbø
Hi, thank you for tips.
I did not use the second code t = cell2table(t);
  2 个评论
Ameer Hamza
Ameer Hamza 2020-5-16
Yes, that was just an example to create a table. If you already have a table, then there is no need.

请先登录,再进行评论。

类别

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

标签

Community Treasure Hunt

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

Start Hunting!

Translated by