how to calculate hamming distance between vectors in matrix
57 次查看(过去 30 天)
显示 更早的评论
i try this code as:
a = [1 0 1 0 1;
0 1 1 1 0;
1 1 0 0 1];
D = pdist(a,'minkowski',1)
the answer came as: 4 2 4 while it should be : 0 4 4 how to solve it? and to make run for bigger matrix as (50x30)
1 个评论
Deeksha Varshney
2017-11-2
firstly change minkowski to hamming then may be you will get correct answer.
采纳的回答
the cyclist
2014-10-19
编辑:the cyclist
2014-10-19
Well, this doesn't give your expected output, but
D = pdist(a,'hamming')
gives the Hamming distance between each pair of rows.
I'm not sure why you used the input argument "minkowski".
12 个评论
the cyclist
2014-10-21
The best form of thanks to accept the answer, which indicates to others (who may have a similar problem) that this resolved the question you posed.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Hamming 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!