Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何计算两个二进制矩阵之间的汉明距离?
例如:
A = [ 1 0 1; 1 1 1 ]; B = [ 1 0 0 ; 0 0 1 ];
非常感谢!
如果汉明距离是指两个矩阵之间的元素距离,您可以简单地使用xor:
xor
D = xor(A,B);
以及元素的总距离:
D_total = nnz(D);