From: Keyur Patel on
I am attempting to sum certain rows from a matrix that is 36192x222.
I was thinking about using loops, because I only want the sum of certain rows.
If you can give tips or examples on this that would be great.
From: Walter Roberson on
Keyur Patel wrote:
> I am attempting to sum certain rows from a matrix that is 36192x222.
> I was thinking about using loops, because I only want the sum of certain
> rows.
> If you can give tips or examples on this that would be great.

sum([4 15 992],:,2)

would result in a 3 x 1 column vector containing the row sums of the 4th,
15th, and 992'nd rows.
From: Jan Simon on
Dear Keyur, dear Walter
> > I am attempting to sum certain rows from a matrix that is 36192x222.
> > I was thinking about using loops, because I only want the sum of certain
> > rows.
>
> sum([4 15 992],:,2)

I assume this is meant:
X = rand(36192, 222);
S = sum(X([4, 15, 992], :), 2);

Jan