The Math Forum

Search All of the Math Forum:

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

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

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

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 ]

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]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.