MATLAB: Find the repetition of matrix rows

matrix

I want to find out if the row i of mxn matrix is repeated ,the code should give logic 1.Otherwise zero"there are many ways but Im searching for the best one" Thanks

Best Answer

a = [1 2 3; 4 5 6;1 2 3; 3 2 4; 1 2 3; 3 2 1; 1 3 2] ;
row2check = 1;
repeated = 0 ;
for i = 1 : size(a,1)
repeated = repeated + prod(double([a(row2check,:)== a(i,:)])) ;
end
fprintf('\n Row number %i is reapeated %i times in matrix!\n\n',row2check,repeated);