Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.


Nick
Posts:
7
Registered:
6/16/14


SumIf
Posted:
Jun 26, 2014 3:48 PM


Hi,
I'm trying to add a column of a matrix given a condition of another column in the same matrix. Here is an example:
A = [ 1 , 20 ; 1 , 30; 1 , 40; 2, 50 ]
I want to add all values of the second column as long as the row on the first column is 1. So, in the case, it would be 20+30+40 = 90.
Any help would be much appreciated. Thanks



