Jump to content
Sign in to follow this  
seanscal

Comparing Two Arrays

Recommended Posts

Hi,

 

What I have is two different files with about 150 different elements each.  These files could have the same elements or could have different ones, so what I need to do is create an array which returns the elements which match from one array with the rest of the row in that array... It's difficult to explain but say these are the two files:

 

array 1                                                      array 2

A                    1                                        A

B                    2                                        B

C                    3                                        E

D                    4                                        F

E                    5                                        G

F                    6                                        H

G                   7

H                    8

 

 

I need a new Array which would be

 

array 3

A                 1

B                 2

E                 5

F                 6

G                7

H                 8

 

try3


I tried this, but what happens is that if, say there were 3 less elements in the second array than the first, my code causes it to take off the last 3 elements in the array instead of the three which were missing

Edited by seanscal

Share this post


Link to post
Share on other sites

I wander if you can take out the other values,the ones that are not match. I try with conditional for loop wit negate.. nothing seems to work....

Share this post


Link to post
Share on other sites
15 hours ago, crossrulz said:

If you want to use Conditional Terminals, I would do something like this.

Compare Arrays_BD.png

yes, the method is good and simple to realize。

Share this post


Link to post
Share on other sites

Sorry I have two excel files with a column of unique numbers respectively. The first column is complete and does not undergo changes, the second column appears to be with the same column but with a lower number of elements.

I converted the excel files into 2D arrays even if only the first column is the one compiled about 900 fields of numbers only

I should look for the array missing elements in the first column. I tried to adapt the "crossrulz" *.VI but I can't find the correct solution

example

ARRAY 1  COMPLETE          ARRAY 2                            RESULT

1                                                     1                                       -

2                                                     -                                        2

3                                                      3                                       -                                      
could you please help me?

 

Edited by Frank22

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.