MATLAB: How to find common values in two matrix for particular column

findlogical?sort

if true
% code
A=[0 1 1 0; 1 0 0 1; 1 1 0 0; 0 0 1 1]
B=[0 1 0 1; 1 0 1 0; 0 0 1 1; 1 1 0 0]
end
for 1st column of A and ALL columns of b
if we check
the expected answer is
1 0 2 1
these are the total number of instances they are matching

Best Answer

>> sum(A(:,1)+B==2)
ans =
1 0 2 1
>>