how do obtain sum of two rows
3 views (last 30 days)
Show older comments
Have a 18482 x 7 matrix. I want to obtain a matrix which contains the sum of row 1 and 2, row 3 and 4, etc until the last ones being the sum of row 18481 and 18482. How do I do this. Thanks in advance
0 Comments
Answers (2)
Walter Roberson
on 14 Dec 2017
output = YourMatrix(1:2:end, :) + YourMatrix(2:2:end, :);
2 Comments
Rik
on 14 Dec 2017
That's what you get with ambivalent questions, there are multiple answers that fit the question.
See Also
Categories
Find more on Introduction to Installation and Licensing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!