LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

I need to perform a union of two arrays to see what are the common items in both


@Sujo wrote:

You can use the search 1D array fucntion and a for loop

 



I'd say that's the "normal" solution, arrays are handled with array functions. Clean and easy. 🙂

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 11 of 14
(991 Views)

i tried sujo's program but was unable to connect the string auto-indexing terminal with comparator output.

is it possible in  LabVIEW 2010 ???

0 Kudos
Message 12 of 14
(984 Views)

LabVIEW 2010 did not have the conditional indexing tunnels.  So you will need to use a shift register, a case structure, and a Build Array in order to conditionally add elements to an array.


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
0 Kudos
Message 13 of 14
(968 Views)

@Sujo wrote:

You can use the search 1D array fucntion and a for loop


It would probably need a little bit more code, because if the indexing array has duplicate elements, the output array will also have duplicate elements. In the general case, the result will differ if you swap the two input arrays.

 

For large arrays, it also becomes very inefficient because the same elements of the non-indexing array need to inspected over and over when searching. For large inputs, It would probably be more efficient to sort tne inputs and then only search from the last looked at "good" location, keeping the "start index" in a shift register.

 

(For small input arrays with no duplicate elements, the shown solution is OK. Trying to achieve the stability and performance of the variant solution using plain array tools would require quite a bit mode code. ;))

 

 

0 Kudos
Message 14 of 14
(946 Views)