Showing results for 
Search instead for 
Did you mean: 

A more efficient lookup table for numeric data?

Go to solution

Hi All,


I've attached a VI that interpolates a data set and then uses the 'Search 1D Array' function to obtain a value for the corresponding value in the interpolated data.


When slotting this VI in my overarching code, it seems to become considerably less responsive at smaller time-steps. After looking up online for more efficient methods of implementing look-up tables, it suggested using variant attributes. However, the post I read suggested that this can only be done for string data inputs.


Is there a more efficient way of doing this? And if variant attributes would work, could somebody show me how?


Any help would be amazing.




0 Kudos
Message 1 of 7
Accepted by topic author ChangoMutney
05-13-2019 12:15 PM

Posting by phone, cannot see your VI.


Is the table sorted? If so, threshold array will give you interpolated data directly and efficiently. Or you can do a binary search.

A real LUT does not give you any interpolation or "most similar", so variant attributes are out.

LabVIEW Champion Do more with less code and in less time
Message 2 of 7

Hi and thanks for your reply.


My array is 2 dimensional in the following format:

RPM          Torque

4000           45.0843

4001           45.0918

4002           45.0992

...etc, from 4000 to 15000


What I would like to do is be able to pick out an RPM value and the code to output the corresponding Torque value.


From my understanding of the threshold array function, doesn't it only work with 1D arrays?


Many thanks,


0 Kudos
Message 3 of 7

Sorry, I may be being a bit dull here. I think i've figured it out.


Thanks very much.

0 Kudos
Message 4 of 7

Based on the information so far (fixed range of integer RPM values) I would create a 1D array of the torque values and then simply index that array using index (RPM-4000).  For example RPM=4001 would correspond to index 1 in your LUT.

0 Kudos
Message 5 of 7
Accepted by topic author ChangoMutney
05-14-2019 04:17 AM

So you want a spline of the original 12 points for a 1RPM resolution. All you need is get the interpolant once, then use it to get any value in-between with unlimited resolution, even for fractional torque values. No need to store the interpolated array at 1rpm resolution, that's just a waste of memory (Your data structures: 264216 bytes, mine 288 bytes, or 917x less!!!). Here's what I had in mind:





LabVIEW Champion Do more with less code and in less time
Message 6 of 7

Thank you very much! That's a really neat piece of code!

Always looking to improve my code! 

0 Kudos
Message 7 of 7