Question: how to calculate the distance between two matrices?
Answer: If you look up "matrix norms", you'll find lots of material. And if ‖‖ is any matrix norm, then ‖A−B‖ gives you a measure of the "distance" between two matrices A and B. Or, you could simply count the number of positions where |aij−bij| is larger than some threshold number.