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: Adding rows in a matrix based on certain criteria
Replies: 2   Last Post: Feb 7, 2013 9:58 AM

Advanced Search

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

Posts: 7,878
Registered: 6/7/07
Re: Adding rows in a matrix based on certain criteria
Posted: Feb 7, 2013 9:46 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 2/7/2013 6:43 AM, Kumar wrote:
...
> ... add rows in matrix based on certain criteria. For example, if
> the values in column 1 is 1 and values in cloumn 2 is 1, then i have to
> add elements in colum 3 of all such rows....


s-sum(x(((x(:,1)==1) & (x(:,2)==1)),3));

--




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.