LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I sort data into different arrays?

I want to take a 1D array and use a compare to sort the element numbers into two list.  This will give me two new 1D arrays that contain all the matching element numbers and all the none matching element numbers.

 

We have a T/F decision to pick one of two inputs based on T or F, but we don't have a router that will send the out put path to option one or two based on T or F.

 

If a case structure is used you still get all the empty elements in the two arrays where the none wired output has to provide something to the array even if it isn't a valid element number.

 

Any ideas?

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

This is basic LabVIEW. Look at the shipping example called Separate Array Values (Help>Find Examples>Fundamentals). If you are using floating point numbers, your compare CANNOT be the equality function.

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

Ok, thanks for the reply.

 

I am using something like this now.   It just seams cumbersome and I was hoping that there would be something that would take a universal input and a T/F input and then route that input to either the true output or false output.  We have the other way around where it will pick one of two inputs but I don't see its reciprocal.

 

Thank you for the reply.

 

Ben P.

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

Don't see what part of the example is cumbersome. Don't understand what you mean by 'universal input'. The example does route to either the true or false case. Do you want to be able to switch the comparison type?

 

Post some code if you have any.

0 Kudos
Message 4 of 6
(2,832 Views)

I guess this is an item for the wish list more then anything.  I have code that works but I am trying to learn more about the structures and ways to use them.  I was looking at the indexing on the output of the for loop and thought that it would be cool to eliminate the shift registers and the need for the case structure.

 

This snippet will not work because the sub.vi is empty but if something like this were to exist so that it would leave the output that was not selected empty then after the For loop was done you would have a 1D array of each selection.  The input could be strings or numbers or even Boolean.

 

As it is I can not see a way that the out put arrays will work because every iteration will provide an output to both array and that isn't the goal.

 

Please don't spend any more time on this as it was just a thought I had while trying to simplify some code.

 

Thanks,

 

Ben P.

0 Kudos
Message 5 of 6
(2,816 Views)

Add a kudo to this

--
Tim Elsey
Certified LabVIEW Architect
0 Kudos
Message 6 of 6
(2,801 Views)