LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Compare 1d array elements and only output unique values

Solved!
Go to solution

So more precisely this is the type of vi I've been trying to figure out.

 

If my input 1D Array String is:        A1, A1, A2, A2, A3, W4, W4  

 

It will output:                                   A3

 

any ideas or links that can help me are appreciated.

 

0 Kudos
Message 1 of 6
(4,272 Views)

What have you tried so far?

Is the array always sorted?

Try variant attributes! 😄

Message 2 of 6
(4,251 Views)

I've tried manipulating delete duplicate vi's to try and take out not just one, but both elements if they match to no avail.

 

and yes I use the sort 1D array to make sure the array is always sorted.

0 Kudos
Message 3 of 6
(4,240 Views)
Solution
Accepted by topic author OJwithPulp

1DA.png

"If you weren't supposed to push it, it wouldn't be a button."
Message 4 of 6
(4,191 Views)
Solution
Accepted by topic author OJwithPulp

The Search Array_ogtk.vi (from the OpenG Toolkit) returns an array of the indices that match the search element. If the returned indices array size is 1 then the element is unique. You can use this with conditional indexing output of a FOR loop. This can also be optimize for large array by sorting the input array and using the last index found as the start index of the Search Array_ogtk.vi for the next loop iteration.

 

Ben64

 

Ben64

Message 5 of 6
(4,181 Views)

Thanks for all your help guys! I ended up finding a workaround using some DB Tools and item name property nodes to get my two multi-column list-boxes communicating properly.

However, I tried out both of your solutions and they worked like a charm! 

 

Also didn't know about the OpenG Toolkit before this, I'll have to continue exploring what else it has included with it Smiley Happy

0 Kudos
Message 6 of 6
(4,150 Views)