Sum of specific row of all the coulumns

1 visualizzazione (ultimi 30 giorni)
I am trying to get the totals in row 7 for all the columns (marked in red).

Risposta accettata

Ameer Hamza
Ameer Hamza il 16 Mag 2020
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})

Più risposte (1)

Milosha Britto Nordbø
Milosha Britto Nordbø il 16 Mag 2020
Hi, thank you for tips.
I did not use the second code t = cell2table(t);
  2 Commenti
Ameer Hamza
Ameer Hamza il 16 Mag 2020
Yes, that was just an example to create a table. If you already have a table, then there is no need.
Milosha Britto Nordbø
Milosha Britto Nordbø il 16 Mag 2020
That's correct. Thank you.

Accedi per commentare.

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by