MATLAB: Comparing between Array Elements and result matrix too

data typematrix manipulationprogramming

hey.. i want to comparing two matrix for example
a = [ 1 2 3 4 5 6]
b = [ 1 3 2 4 5 6; 1 2 3 4 5 6; 2 2 3 4 5 6]
if elemen in matrix a same with elemen matrix b, its result
c = [1 0 0 1 1 1; 1 1 1 1 1 1; 0 1 1 1 1 1]
Do you have any suggestion ? thanks..

Best Answer

c=bsxfun(@eq,b,a)