LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
viScience

Add threshold index output on interpolate 1D array function when the 1D array input is an array of points.

Status: New

The interpolate 1D array function has a powerful but under appreciated feature of being able to do segmented linear interpolation when the array input is an array of points.  (For example in an array of PID profile setpoints).  The interpolate function will directly produce the correct interpolated y value for any 'segment' in the array which is very cool.  However it does not expose the threshold index which would be very useful and is most certainly already computed internally.  In the use case of traversing an array of PID profile setpoints, it would be good to know what segment is being interpolated at any given time.

5 Comments
wiebe@CARYA
Knight of NI

Doesn't a Round Toward -Infinity give you that?

 

A Q&R with 1 gives you the index and fraction.

wiebeCARYA_0-1777023054779.png

It seems to be very little effort to get what you're asking for.

 

Adding the index will change the connector pane and might break things. Maybe not, but given the gain why risk it?

viScience
Active Participant

I am talking about the case where the Interpolate 1D array is receiving an array of points.

 

1D Interpolation.png

This is a test case to illustrate what I am referring to.  

crossrulz
Knight of NI

The solution could be the output is a cluster containing the calculated X and Y values. I'm not sure if that would be helpful or cause more confusion.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
viScience
Active Participant

Still I would like some appreciation of the original suggestion which is for the case where the 1D Interpolation is being used to perform segmented linear interpolation (which in itself is certainly not well known) it would be nice if there was a 'segment' or array index output since it is already being computed internally and is not as trivial as you indicated to compute externally.

wiebe@CARYA
Knight of NI

I think the function has some of that magic, but the description is wierd and it's very tricky.

wiebeCARYA_0-1777970666457.png

 

wiebeCARYA_2-1777970976789.png

So the function interpolates on the Y values, and returns the interpolated X value.

Of course you could argue that you now want the index returned. And that's fair 🤗.