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.
Solved! Go to Solution.
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.
Hi and thanks for your reply.
My array is 2 dimensional in the following format:
...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?
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.
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: