LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to choose some elements from an array?

Solved!
Go to solution

Hi all,

 

I wander if there is someone can help me to solve this issue....

 

Let's say I have 100,000 element {0,1,2,....... 99999}, and they are distiributed in an unsequence order. Then, we want to choose only the numbers which are above 80,000. How can I do it? Thanks in advance

 

Regards 

0 Kudos
Message 1 of 5
(3,091 Views)
Solution
Accepted by topic author Al-rawachy

fast way is use sort 1d array search to nearest value bigger that 80,000 and delete from array

but if position of your value is important best way is use 

Message 2 of 5
(3,079 Views)

What do you want to do with the data after you have found the elements you want?

 

You could sort them and then use Search 1D Array. All of the larger elements will be at or after the index returned by search. Of course this destorys the original order.

 

Use Greater? comparison. Connect the array to the top input and a constant = 80000 to the lower input. The output will be an array of booleans with Trues in each element corresponding to an element about 80000 in the data.

 

Run the data through a for loop. Put the Greater? comparison inside the loop. Wire the data to an output tunnel. Change the Tunnel Mode to Conditional and wire the output of Greater? to the "?" input of the tunnel.

 

Lynn

 

Message 3 of 5
(3,071 Views)

If using 2013 or newer, conditional tunnels are your friend.


GCentral
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 4 of 5
(3,066 Views)

Hi all,

 

I am so grateful for your support, It's really helpful. One more question if you don't mind....

 

I have the array in the attached photo and Vi has 39 elements. these elements change it's position every time. As I told you before, I want to seperate the 3 elements of the lowest values which are (-150) and put them in the first array, then I want the next element start comming in the array after those three elements, and finally save again the remaining three elements -150 at the end of the array as per attached in result photo. But as you can see the worest case when the 6 elements of -150 come after each other..

 

Sorry for disturb you, I know it's challenge,but I am sure you are more proeffesional than me.Thanks in advance

 

Regards 

Download All
0 Kudos
Message 5 of 5
(3,002 Views)