ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

scan from array and compare

Solved!
Go to solution

OK, Thanks.  I was trying that in the attached VI but got stuck as to how to parse the correct values out.  I changed the +/- limit from 5 to 2 as you can see in the attached VI. How do I stop the scan as soon as I find the correct x,y data and move onto the next item in the original Array i.e, as soon as I find the value satisifying the limit for 120 (i.e. the 118 x-value), I capture that data and then move onto the second item in the Array 161.088??

 

Thanks,

hiNI

 

0 Kudos
Message 11 of 15
(1,062 Views)

Replace the inside FOR loop with WHILE loop.

Message 12 of 15
(1,056 Views)

 

Hello,

 

I got it to work but would like to increase the complexity a bit.  There are instances where the scanned x-data value may be closer to the value in the previous or next item.  For example, in the below snapshot of the txt data file, if I am scanning for 161.088, the closest value is 161.251:

 

161.255 -0.5907
161.251 -0.59145
162.125 -0.58748

 

In another snapshot, the cloest value while scanning for 325.248 from:

324 -0.891
324.875 -0.872
325.75 -0.882


is 324.875

 

I am just trying to extract the closest data point.  If I use a less than equal comparison, I do not always get the closest value.  Also, the difference between the "scanning for value" and the Array value varies.  How can I go about getting the closest value from the text file.

 

Download All
0 Kudos
Message 13 of 15
(1,050 Views)

Hello,

 

I would like some help to extract the closest value from the txt file that corresponds to a given fixed array.

 

For example, in the below snapshot of the txt data file, if I am scanning for 161.088, the closest value is 161.251:

 

161.255 -0.5907
161.251 -0.59145
162.125 -0.58748

 

In another snapshot, the cloest value while scanning for 325.248 from:

324 -0.891
324.875 -0.872
325.75 -0.882


is 324.875

 

I am just trying to extract the closest data point.  If I use a less than equal comparison, I do not always get the closest value.  Also, the difference between the "scanning for value" and the Array value varies.  How can I go about getting the closest value from the text file.

 

Any help will be sincerely appreciated.

 

Thanks,

hiNi.

Download All
0 Kudos
Message 14 of 15
(1,027 Views)
Solution
Accepted by topic author hiNI

@hiNI wrote:

I am just trying to extract the closest data point.


 



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
Message 15 of 15
(1,023 Views)