LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Creating a 3D lookup table from CSV

Solved!
Go to solution

Ok, then a solution to my problem could maybe be to use the VI "TrilinearInterpolationTester".

 

After that for the gridlines (X, Y, Z) I can just put them into the built in "interpolate 1D Array function?"

0 Kudos
Message 31 of 40
(1,351 Views)

Ok now I have looked into the trilinear VI a little bit more. And as you mentioned the interpolation. And the fractional indexes can as you mentioned be calculated with help of the treshold array. '

 

What I do not understand is why the incircled array and constant is structured the way they are? Also why is the length sent to the array subset array set to 2? Maybe all these values are default values?

 

antje668_0-1655576713128.png

 

Will this function also interpolate the x, y, z inputs that I feed to the table? 

 

0 Kudos
Message 32 of 40
(1,340 Views)

You need to threshold into your three axes to get the fractional indices. The trilinear interpolation uses the 8 nearest values to calculate the interpolation in that cube.

0 Kudos
Message 33 of 40
(1,336 Views)

Alright I think I understand. So the purpose of the fractional indices is to "fill in the gap" where the interpolated output w is for the corresponding fractional index combination of x y z?

 

What threshold value should I set for each axis, is it something I chose freely?

 

Also is it possible to instead of giving index values give the actual value AT the index when the values has been interpolated? Like its possible to do in the previous example you helped me with?

0 Kudos
Message 34 of 40
(1,325 Views)

For each coordinate (x, y, or z), you would use it to threshold into the corresponding ramp (x, y, or z) to get the fractional index in each dimension.  Use these for the trilinear interpolation.

0 Kudos
Message 35 of 40
(1,317 Views)

All you probably need is this code, remove the "to I32", and replace the index array with my interpolation.

0 Kudos
Message 36 of 40
(1,306 Views)

If I understand you correct do you mean like this?

 

antje668_0-1655630090376.png

 

I tested it aswell and it really seems to work actually. If needed I also attached the VI together with the gridlines CSV.

0 Kudos
Message 37 of 40
(1,298 Views)

You don't need the "index array...built array" song & dance in the lower loop. Just wire the 1d array directly. Same thing, less code!

0 Kudos
Message 38 of 40
(1,292 Views)

That is true, does the code looks reasonable besides from that?

 

Btw which function fills the constant matrix in the Interpolation VI?

0 Kudos
Message 39 of 40
(1,286 Views)

A few more comments:

 

  • Don't maximize the front panel and diagram to the screen!
  • Don't use greedy interactive loops. (The while loop needs a small wait.)
  • Don't make a horrible mess with all that whitespace, overlapping diagram objects and hidden wires.
  • Don't use three scalar controls if one array control can serve the same purpose with 3x less code!.
  • You need a better state machine and better error handing (not shown).
  • It is trilinear, not trinlinear.

 


@antje668 wrote:

 

Btw which function fills the constant matrix in the Interpolation VI?


The diagram constants are filled manually according to the theory. It is a 2D array, not a matrix. 

 

0 Kudos
Message 40 of 40
(1,271 Views)