How can I find the differences between two matrix? I should find the diverse numbers.

## All 5 Replies

I find it funny how you are just spam posting really short questions and not really going into any detail. No one will help you if you don't do a bit of work and show us that you have done a bit of research on your end.

Couldn't you just compare it like they're just two arrays.. but with an extra for?

I mean, if I give you two pieces of paper with a matrix on each of them, that's the way your
brain would do it. Here's some pseudocode, because if I were to give you real code, you would just copy it and learn nothing.

``````flag = 1
for i = 1 to i <= n
for j = 1 to j <= m
if m1[i][j] is not equal to m2[i][j]
flag = 0
break
if flag is equal to 0
break
if flag is equal to 1
etc...
``````

Let's hope you'll actually code this.

I think when he is saying "difference" he wants to compare them. What you're suggesting could also do that ( `if(m1[i][j]-m2[i][j])==0` ), but it would also be a tad more counterintuitive...