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: Efficient general purpose 1D lookup table?
Replies: 7   Last Post: Jan 6, 2014 11:58 AM

Advanced Search

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

Posts: 263
Registered: 2/23/10
Efficient general purpose 1D lookup table?
Posted: Dec 5, 2013 10:12 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

I have a set of unique integers that map to another set of unique integers. Neither set is necessarily contiguous or monotonic. I would like to implement this as a translation/lookup table. Googling lookup and matlab yields many means of interpolating, but that's not the context I'm working in. I can use ismember to create a translation table, but that uses the index of one array as the value to be translated. It allows me to vectorize the translation of a series of input values, but since the possible input values are not necessarilly contiguous, using the array index does not seem elegant.

Of course, I can write a function that accepts a lookup table in the form of a Nx2 array and simultaneously accepts a vector of input values to translate. My function would loop through each input value, look them up, and return the results (collected into a vector). I was hoping there was a ready-to-use vectorizable way to do this.



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.