LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

compare array and output common elements

Solved!
Go to solution

Hello,

 

Can you help me to compare the two arrays in the attached VI file and output the elements that are common to the two arrays?

 

Thanks,

hiNi

0 Kudos
Message 1 of 16
(4,343 Views)

Maybe something like this?

 

 If your arrays are large, there are probably much more efficient ways. 😉

Message Edited by altenbach on 03-05-2009 07:19 PM
Download All
Message 2 of 16
(4,336 Views)

Hello,

 

I seem to only get the last element in the 'sames' array.  Is there a way to get all the same elements in the output array?

 

THANK YOU for your help!!!

 

hiNi

0 Kudos
Message 3 of 16
(4,312 Views)

Hai,

 

I gave some test values to the vi and the logic works fine.  I get all the similar elemants in the output array.  What is the exact problem you are facing.

Post with screen shots.

 

With regards,
JK
(Certified LabVIEW Developer)
Give Kudos for Good Answers, and Mark it a solution if your problem is solved.
0 Kudos
Message 4 of 16
(4,310 Views)

I've got OpenG array functions on the brain this morning, and a touch of Rube-Goldberg, so here's how I did it.  Add the array elements, delete the duplicates saving the array of indices to use when deleting the duplicates from the original (concatenated) array.  Use the deleted element output and Bob's your uncle, too.

 

Message Edited by jcarmody on 03-06-2009 05:25 AM
Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

Download All
Message 5 of 16
(4,286 Views)

This is the problem I get.  I don't get all the elements in the final array.

 

Thanks,
hiNi.

Download All
0 Kudos
Message 6 of 16
(4,265 Views)
Solution
Accepted by hiNI

You didn't wire the array through the False state in your Case structure.  Use default if unwired is selected for that tunnel; the default for that tunnel is an empty string array.  Run the wire straight through and Bob is your father's brother.

 

Message Edited by jcarmody on 03-06-2009 11:57 AM
Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

Message 7 of 16
(4,254 Views)

Are those functions on your VI only availabe on LabView 9?  I am running labview 8.2 and don't see those blocks.

 

Thanks,

hiNi.

0 Kudos
Message 8 of 16
(4,247 Views)
THANK YOU!  THAT WORKS PERFECT!!!
0 Kudos
Message 9 of 16
(4,244 Views)

hiNI wrote:

Are those functions on your VI only availabe on LabView 9?  I am running labview 8.2 and don't see those blocks.

 

Thanks,

hiNi.


I would surely hope not! LabVIEW 9 isnt even out yet. And if it is, why was I not informed? Smiley Wink

What 'blocks' are you referring to?

 

And can you please mark the post that answered the original question as the solution rather than your own.

Message Edited by Cory K on 03-06-2009 12:10 PM
Cory K
0 Kudos
Message 10 of 16
(4,243 Views)