taking data from a matrix and summing to a new vector

1 view (last 30 days)
Im trying to take the values from a matrix, say 8 columns and 40 rows, and take column 3, 4, and 5s data and sum it up for every row and making a vertical vector of these values.

Accepted Answer

Honglei Chen
Honglei Chen on 25 Feb 2013
Here is an example
x = rand(40,8);
sum(x(:,[3 4 5]),2)

More Answers (0)

Categories

Find more on Multidimensional Arrays 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!