Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: SumIf
Replies: 5   Last Post: Jul 1, 2014 1:42 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Nick

Posts: 7
Registered: 6/16/14
SumIf
Posted: Jun 26, 2014 3:48 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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


Date Subject Author
6/26/14
Read SumIf
Nick
6/26/14
Read Re: SumIf
Nasser Abbasi
6/26/14
Read Re: SumIf
Nick
7/1/14
Read Re: SumIf
Nick
7/1/14
Read Re: SumIf
Ben
7/1/14
Read Re: SumIf
Nick

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.