how to calculate hamming distance between vectors in matrix
조회 수: 13 (최근 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!