A
A
Alexander2016-06-07 16:19:42
Image processing
Alexander, 2016-06-07 16:19:42

How to calculate Hamming distance in matlab?

Hello. Need a little help. There are two codes derived from binary images: 71113773FECCCCC0 and 31111333ECDCEECC . How to calculate Haming distance between these two hex values?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Александр Скуснов, 2016-06-08
@akrchnv

X = '71113773FECCCCC0';
Y = '31111333ECDCEECC';

%%
xv = double(hexToBinaryVector(X, length(X)*4));
yv = double(hexToBinaryVector(Y, length(Y)*4));

%%
D = pdist([xv; yv])
D = pdist([xv; yv], 'cityblock')
D = pdist([xv; yv], 'hamming')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question