Hi there I have a matrix of size 298 x 19. I want to have just one column, so 289x1, but it to be the addition of the row.
So I want to add all the columns to turn it to 298x1.

 Accepted Answer

Oleg Komarov
Oleg Komarov on 28 May 2012

0 votes

Sum along dimension 2 (columns):
sum(A,2)

More Answers (1)

Thomas
Thomas on 28 May 2012

0 votes

is this what you need
q=rand(2,3) % random matrix 2x3
out=sum(q,2) % sum each row so output is just 1 column for each row

Categories

Tags

Community Treasure Hunt

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

Start Hunting!