I want to get the duplicates of a vector. Lets say I have a vector as follows:
A = [ 1 5 3 2 3 1 ];
I want to get a vector which contains the duplicates [1 3].
I found intersect, union and unique but they give me just the vector w/o the duplicates. In this example unique(A)=>[1 2 3 5]. So I just need a function to compare the original vector A with the results of lets say unique(A) and return the remaining members. Can this be done vectorized w/o nested for-loops? Or is there a more elegant approach available?