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: lookup table
Replies: 6   Last Post: Dec 6, 2012 10:12 AM

Advanced Search

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

Posts: 4
Registered: 12/3/12
lookup table
Posted: Dec 6, 2012 2:32 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Hi all,
I need to find the fastest way to compare to vectors. here is a little example:
% I got 2 vectors
a=[1 2.4 3.1 4.9 5.7]
b=[1.2 5.9 4.7 2.3 9.5 6 4.8] % b is a very long vector
every number in b should search in a for the next lesser number. The answer should be like this:
[1 5.7 3.1 1 5.7 5.7 3.1]

Is there a fast way. Maybe without a loop.
Thank you



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.