08-31-2015 11:36 AM
Hi,
i want to compare tow array and result will be stored in third array
resultant array will contain distinct elements (element that are not same in both arrays)
result is shown fig given
08-31-2015 11:55 AM
Use a For loop to iterate through the smaller of the two arrays. For each element in the one you're iterating through, search the other array for the element. Output only elements that resulted ina value of "-1" during the search.
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'
08-31-2015 12:05 PM
What if array 1 had a 6 in it that is not in array 2. Would you want that to show up in array 3?
08-31-2015 01:53 PM
NO, ARRAY1 WILL BE SUBSET OF ARRAY2
08-31-2015 01:59 PM
OKAY THEN INCREMENT THROUGH ARRAY1 AND SEARCH ARRAY2 LIKE I SAID ABOVE
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'
08-31-2015 02:16 PM - edited 08-31-2015 02:16 PM
@James.M wrote:
OKAY THEN INCREMENT THROUGH ARRAY1 AND SEARCH ARRAY2 LIKE I SAID ABOVE
Actually, I would do the opposite.

08-31-2015 02:17 PM - edited 08-31-2015 02:18 PM
No. Increment through array 2. Search for the element in array 1, and if an element does not exist in array 1, than include that in array 3. (conditional auto-indexing tunnel if you have a relatively recent version of LabVIEW)
EDIT: Crossrulz with the example for the WIN!
08-31-2015 02:21 PM - edited 08-31-2015 02:22 PM
Duhhh, I feel dumb.
I was thinking in terms of fewer iterations, but you end up with more processing in the end that way by removing elements instead of outputing from the main in the first place.
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'
09-03-2015 11:40 AM
zeeshanhameed, don't send PMs to people for help, especially when you never responded to this thread after you recieved multiple responses with adequate solutions (crossrulz and RavensFan above). The forums are here for a reason. Please post your questions or requests for advice in the appropriate board. This will help you get a better answer and this helps others with similar problems find their own answers in the future.
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'