taking data from a matrix and summing to a new vector

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.

 採用された回答

Honglei Chen
Honglei Chen 2013 年 2 月 25 日

0 投票

Here is an example
x = rand(40,8);
sum(x(:,[3 4 5]),2)

その他の回答 (0 件)

カテゴリ

Community Treasure Hunt

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

Start Hunting!

Translated by