简体   繁体   English

在Matlab中计算两个二进制数字串之间的汉明距离

[英]Calculate Hamming distance between two strings of binary digits in Matlab

I have two equal length strings containing 1's and 0's. 我有两个相等长度的字符串,包含1和0。 Each string is 128-bits long, and I want to calculate the Hamming distance between them. 每个字符串长128位,我想计算它们之间的汉明距离。 What's the best way I can go about doing this? 我能做到这一点的最佳方式是什么?

eg a='1000001' and b='1110001' --> dist=Hamming(a,b); 例如a ='1000001'和b ='1110001' - > dist =汉明(a,b);

pdisthamming参数一起使用。

dist = sum(a ~= b);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM