LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Filter array

Solved!
Go to solution

Hi everyone, 

I am trying to create 2 new arrays from one array on the basis of their value. I want to filter array values as less than and greater than 2. I have tried out a few things but its not working....The below is incomplete but I don't know what else to do,...

0 Kudos
Message 1 of 3
(937 Views)
Solution
Accepted by topic author ms6

You don't need a While Loop, but a For Loop to take each element from array, compare it and rebuild the array only with the filtered elements using a conditional indexing output tunnel:

LucianM_0-1701760085415.png

 

Lucian
CLA
Message 2 of 3
(911 Views)

Hi ms6,

 


@ms6 wrote:

I am trying to create 2 new arrays from one array on the basis of their value. I want to filter array values as less than and greater than 2. I have tried out a few things but its not working....


So you want to create one array with all values <2 and one array with all values >2?

What should happen with array elements ==2?

 

Suggestion:

  1. Autoindex the input array at the FOR loop border.
  2. Use a comparison function of your choice.
  3. Autoindex the elements at the FOR loop border to build the output arrays.
  4. Set the tunnel to conditional and set the condition as needed for each output array…

Autoindexing is very basic LabVIEW stuff, as well as all the options of loop tunnels.

Did I recommend the LabVIEW Training resources before?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 3 of 3
(909 Views)