-3

I have two matrices: A=[1,2,3,4,5] and B=[1,2,3,4,6]. I need to compare elements of those matrix, and as a result I need to have binary matrix Result=[1,1,1,1,0], that means if A(i)==B(i) then Result(i)=1 else Result(i)=0.

I have tried with:

if (isequal (A,B))
   Result=1
else
   Result=0
end

I have tried: Result=sign(A,B)

I hope that you could help me please?

Stewie Griffin
  • 14,889
  • 11
  • 39
  • 70
Guillaume
  • 123
  • 4
  • 13

1 Answers1

3
A = [1,2,3,4,5]
B = [1,2,3,4,6]
Result = A == B
Janez Kuhar
  • 3,705
  • 4
  • 22
  • 45