LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Interpolating data from excel

Hi,
I have a VI for pressure measurement. On a waveform chart I have SOP being generated on the y axis and time on the x axis. Now the SOP values that are generated have corresponding pressure values which are stored in an excel file.
How do I compare the SOP values that are being generated in the VI to the corresponding pressure values in excel? Moreover if the SOP values that are generated in the VI are not exactly what are stored in the excel file, is there some way in which the corresponding pressure value can be interpolated?
For eg. in excel if I have SOP=0.5 corresponding to P = 30 MPa and another value of SOP=0.6 corresponding to P = 35 MPa, then if in the VI if I get a value of SOP = 0.57, can I get some kind of an interpolation to get the corresponding pressure, say 32MPa?

Would be grateful if someone could help.
Another thing, all this has to be in real time.
Thanks
0 Kudos
Message 1 of 6
(3,485 Views)
Hello Dhiraj,

I see 2 possibilities :
 - 1, if the corresponding table (SOP - pressure) is more or less linear (or quadratique or polynomial) you can read the excel spreadsheet, find the best polynomial fitting then use the coefficients to find the correspondance at every new value.

- 2, load your excel table as a 2D array and then use the interpolate array.

I assume you can find good sources of inspiration in "Help" >> "Find example..." if not, feel free to ask for more help, I should be able to find VIs taht do more or less the same in my old ViBox.

We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 2 of 6
(3,480 Views)
Hello TiTou,
Thanks for the reply.
SOP is related to pressure P through a cosine function:

SOP = cos(2*pi*L/Lambda(B + PKp))

Everything is a constant except P, the pressure. However since cos is a many to one function, a number of values of pressure, P, correspond to the same value of SOP. I am looking for a very specific range of pressure (from 39.2 MPa to 39.3MPa and fortunately for me, there is an almost  linear relationship between SOP and P for this range). And since I am looking for a specific range, I have stored it seperately in an excel file. Carrying out an acos of the SOP and finding out P gives me values of P which are quite obviously not in the desired range because of the many to one cos function. That is why the seperate excel file for storing the requisite P values for the corresponding SOP.

Basically what I am looking for is that as the VI is run (right now I am simulating the pressure), a waveform chart should display the pressure corresponding to the SOP being generated. Any idea how to do this?

Dhiraj
0 Kudos
Message 3 of 6
(3,477 Views)
Dhiraj,

I am not sure you need a a LUT (Look Up Table), maybe the attached VI can do the job, no ?

Anyway if you want (or need) to use a LUT, I suggest you do a search on the forum with "LUT" or "look up table" as a keyword, I saw threads on that subject earlier.

Regards

We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 4 of 6
(3,472 Views)
TiTou,
I think you forgot to attach the VI!!
0 Kudos
Message 5 of 6
(3,470 Views)
woops... indeed... someday I'll forget my head Smiley Very Happy !

We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 6 of 6
(3,466 Views)