MAtrix

5 次查看(过去 30 天)
Mate 2u
Mate 2u 2012-5-28
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.

采纳的回答

Oleg Komarov
Oleg Komarov 2012-5-28
Sum along dimension 2 (columns):
sum(A,2)

更多回答(1 个)

Thomas
Thomas 2012-5-28
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

类别

Help CenterFile Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by