Comparing A and B can be easily done by using looping procedure, the difficult thing is after getting preliminary similar-data, for example, Similar1 =[1 1] and Similar2 =[3 3], then we still need to compare B(1) and B(3) as well other data [B(3) B(4)] with the data in C. If B(1) and B(3) is the same as those in C, we need to include the value to Similar1 and Similar2. Moreover, if B(3) and B(4) match with those in C we need to create a new array Similar3, and so on...Probably you have an experience to do this kind of analysis. Thanks for sharing, I really appreciate it.