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: vector manipulation
Replies: 3   Last Post: Feb 19, 2013 7:51 PM

Advanced Search

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

Posts: 9,242
Registered: 6/7/07
Re: vector manipulation
Posted: Feb 19, 2013 7:51 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 2/19/2013 5:38 PM, Raymundo Marcos-Martinez wrote:
> "Elnaz " <ebsadeghian@gmail.com> wrote in message
> <kftvaa$j37$1@newscl01ah.mathworks.com>...


>> I want to subtract all the elements of a vector from an scalar
>> one-by-one to get a scalar and I want to avoid looping. For example
>> say I want to do 8-[1 2] to get 8-1-2=5. How can I do that?


> I am sure there is a more elegant and general answer. In the meantime ...
> a = 8;
> b = [1 2];
> x = a - b(1) - b(2); % --> a-(???)

doc sum % again... :)


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

[Privacy Policy] [Terms of Use]

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