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: Sum selected elements of a vector
Replies: 2   Last Post: Mar 15, 2013 3:10 AM

Advanced Search

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

Posts: 213
Registered: 3/13/10
Re: Sum selected elements of a vector
Posted: Mar 14, 2013 7:59 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

% One way (I'm certain there are betters):
r = rand(4, 6);
x1 = squeeze( sum( reshape(r.', size(r, 2), [], 2), 2 ) ).';



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.