필터 지우기
필터 지우기

how to calculate hamming distance between vectors in matrix

조회 수: 13 (최근 30일)
jim
jim 2014년 10월 19일
댓글: Deeksha Varshney 2017년 11월 2일
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
Deeksha Varshney 2017년 11월 2일
firstly change minkowski to hamming then may be you will get correct answer.

댓글을 달려면 로그인하십시오.

채택된 답변

the cyclist
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".
You can see details in the documentation.
  댓글 수: 12
jim
jim 2014년 10월 21일
편집: jim 2014년 10월 21일
it works right now... thanks alot
the cyclist
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 CenterFile Exchange에서 Hamming에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by