02-20-2015 10:52 PM
I need to find the items that are common in two separate arrays. Is there a union operator for arrays or an intersection operator? The example on the forums is written in an older version of labview and I cant open it.
02-21-2015 12:04 AM
@id wrote:
The example on the forums is written in an older version of labview and I cant open it.
Link to the old example?
02-21-2015
12:49 AM
- last edited on
06-10-2025
08:19 AM
by
Content Cleaner
Why in the world would you want to compute the union? The union will merge the two arrays into one and lose any information about which elements existed in the two original sets. That won't help you find out what was common to both at all. You're on the right track with the intersection. THAT is what you want to compute.
Here's an example from LAVA assuming your arrays are pre-sorted: https://lavag.org/topic/13187-computing-array-intersections/
I'm guessing this is the example you're referencing: http://www.ni.com/example/28766/en/
If so, post it in the version conversion forums and I'm sure someone will take the time to help you convert it. I don't have 8 installed on this computer so I'd be useless in converting it if this is the example you're talking about. If not, give it a try.
02-21-2015 10:44 AM
@id wrote:
I need to find the items that are common in two separate arrays. Is there a union operator for arrays or an intersection operator? The example on the forums is written in an older version of labview and I cant open it.
In any case, this seems like quite a trivial task?
What is the datatype of the arrays?
Are there possibly duplicate elements?
Should the output be a sorted array of the common elements?
How big are the arrays?
What have you tried? Seems like a good exercise. 😄
02-21-2015 11:32 AM - edited 02-21-2015 11:35 AM
@id wrote:
I need to find the items that are common in two separate arrays.
There are many ways to do this. One easy solution would use variant attriibutes, e.g. as follows:
02-21-2015 03:17 PM
That, Christian, is why you are a Knight of NI! A very elegant solution, but I suspect the Original Poster is a student just learning LabVIEW and wanting to learn how Arrays work. I must confess when I read "One easy solution would use variant attriibutes", my reaction was "What??!!" -- it is certainly something that wouldn't occur to me right away!
Bob Schor
02-22-2015 01:35 PM
Thank you sir.I was looking for a compact codefunction like this arrangement. I was wondering if it was hidden in an add on toolkit oe something that I hadnt enabled.
02-22-2015 10:07 PM
02-23-2015 04:45 AM
sir can you tell me how u combined 2 auto-indexing in the for loop together
looks like string will b inserted in the array only if boolean auto-indexing is true
im using LabVIEW 2010
02-23-2015 05:03 AM
You can use the search 1D array fucntion and a for loop
Regards
Abraham Kurien
CLD
Captronic Systems