LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

1D array with two consecutive points rejection

Solved!
Go to solution

Hello,

 

I have 1D array with 10 measurement points. I treat the points in pairs and depending on the difference between the two consecutive points I make decision weather the two points should stay in the array or should be rejected. For an example my 1D array looks like this: 10, 20, 30, 35, 40, 44, 50, 51, 60, 69. I calculate the difference between consecutive points in pairs: 20-10=10, 35-30=5, 44-40=4, 51-50=1, 69-60=9. I would like to reject from the array the points with the difference value smaller than 2. So in my case that points are 50, 51, and the array after the rejection should have 8 elements and look like this: 10, 20, 30, 35, 40, 44, 60, 69. What is the most elegant way to do it? I am running LabVIEW 8.6.

 

Thanks in advance!

0 Kudos
Message 1 of 6
(2,561 Views)

You are going to have to loop through the array checking each two data pair.

 

DeleteFromArray.png

 

What if you have 3 consecutive points with difference value smaller than 2?

Omar
0 Kudos
Message 2 of 6
(2,553 Views)

Hello Omar,

 

thanks, it works, but your question is relevant. If the two pairs with the differences smaller than 2 are consecutive it will not work. Have you any suggestions?

0 Kudos
Message 3 of 6
(2,524 Views)

What if your array contained

 

10,20,21,22,23,24,25,30

 

Would you reject 20,21,22,23,24,25 leaving only 10,30 as your output?

If not, then we need better defined requirements.

 

0 Kudos
Message 4 of 6
(2,514 Views)
Solution
Accepted by topic author -Chris-

Reviewing your original post and your example to better understand your stated requirements.

 


"I treat the points in pairs"


 

Are you required to only consider the 1st and 2nd point pair, then only consider the 3rd and 4th point pair so on and so on.

Never consider the 2nd to the 3rd or the never consider the 4th to the 5th so on and so on?

 

How big is your array? If it is very large (1000000 of points) you might need to consider other options for speed and memory usage.

Message 5 of 6
(2,507 Views)

Hi OmarGator

 

My arrays are up to 20 points. The problem is solved.

 

Thanks!

0 Kudos
Message 6 of 6
(2,495 Views)