MATLAB: Having problem with ‘intersect’ function, not giving the obvious result

intersectproblemwrong answer

Hi everyone, I am using intersect function to compare different arrays and find find out the common rows between them. But I am facing a problem with its result. When I am comparing an array 'H' which is of size 155010×3 double with itself i.e. 'H' it is giving the result as 25896×3 double. However both of them are same so the result should be actual size of 'H' i.e 155010×3 double.
Picture is also attached below.
Anyone please guide me about this.

Best Answer

According to the documentation, intersect reports only the unique rows, without repetition.
You may be able to glean more info from the other output arguments ...
[HH,ia,ib] = intersect(H,H,'rows')
which will indicate which rows of the input matrices were included in the intersection.