MAtrix

1 Ansicht (letzte 30 Tage)
Mate 2u
Mate 2u am 28 Mai 2012
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.

Akzeptierte Antwort

Oleg Komarov
Oleg Komarov am 28 Mai 2012
Sum along dimension 2 (columns):
sum(A,2)

Weitere Antworten (1)

Thomas
Thomas am 28 Mai 2012
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

Kategorien

Mehr zu Random Number Generation finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by