LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

obtain same row 2nd dimension value base on 1st dimension value of a 2d array

Solved!
Go to solution

Hi,

 

I have a 2d array of numerals.

If i require to extract the Y value automatically from a chosen X value from a numerical control. How do i do this?

 

 

BP

 

 

 

 

 

0 Kudos
Message 1 of 9
(5,218 Views)

Don't understand your question. Please give an example.

0 Kudos
Message 2 of 9
(5,197 Views)

I think my question is not correctly phrased. Let me try again with the attached vi as an example:

 

I have a 2d array of numbers which is plotted as a curve on a xy graph. 

 

With a given x axis value (eg 0.25). I require the corresponding Y axis value. I think i can do this by feeding the array into an autoindex FOR loop and comparing the X element for 0.25 and using the iteration of the loop as the index of the array to obtain the corresponding Y element value.

 

However, the array may have values close to 0.25, but not exactly at 0.25 (in the attached example if you look at the cursor of the xy graph it is at X=0.2493, Y=901.688 and the next data point X=0.2502, Y=902.702. But i require the Y axis value at X=0.25

 

Hence I require a line curve that interpolate across all the points. 

and based on that fitted curve, i take the x axis point of 0.25 and obtain the corresponding Y value. Is this possible?

 

 

 

Download All
0 Kudos
Message 3 of 9
(5,191 Views)
Solution
Accepted by BPBP

Use the Interpolate VI.

Message 4 of 9
(5,186 Views)
Was tinkering with interpolate 1d array prior to your post but that needed alot of work.
Your suggestion was exactly what i was looking for. Thanks!
0 Kudos
Message 5 of 9
(5,179 Views)

 


@BPBP wrote:
Was tinkering with interpolate 1d array prior to your post but that needed alot of work.
Your suggestion was exactly what i was looking for. Thanks!

You can still use that function, but you'd need to use Threshold 1D Array prior to it:

 

Message 6 of 9
(5,173 Views)

If you would rearrange the graph data as array of xy points instead of a cluster of arrays (xy graph accept both!), the code will be simpler and you can use the interpolate array directly without using threshold.

 

Here's a quick draft. Modify as needed. For a simple demo, run the VI, wait until plot completes, then move the x-slider.

 

Download All
Message 7 of 9
(5,166 Views)

I have a simple x-y data,custom scale (TABLE)  created in MAX and I want to use it to interpolate values based on an input.  How do I put this into a vi?  Do I need to convert the TABLE to an array somehow, or can the vi read the custom scale directly?  Is there a special tool in Labview that reads the TABLE and interpolates for me.  What functions do I need to assemble to achieve this interpolation?

 

Thanks,

Dave

0 Kudos
Message 8 of 9
(4,918 Views)

@dav2010 wrote:

Do I need to convert the TABLE to an array somehow, or can the vi read the custom scale directly?  Is there a special tool in Labview that reads the TABLE and interpolates for me.  What functions do I need to assemble to achieve this interpolation?

 

Thanks,

Dave


A table is an array of strings. You need to convert it into an array of points. THere are many ways to do that.

 

For example, you can autoindex the array of strings on a FOR loop and operate ono a row at a time. Convert the fractional strings to an array of two DBLs, use array to cluster with output size=2 to convert to a point cluster, and autoindex at the output loop boundary to get an array of points. No use it as above. 

0 Kudos
Message 9 of 9
(4,704 Views)