フィルターのクリア

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 Center および File ExchangeHamming についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by