error in calculating distance

조회 수: 1 (최근 30일)
kash
kash 2012년 2월 5일
i have two matrices A,B
i calculate euclidean distance
by
Distance=EuD( A,B)
i get answer
but if i have 4 matrices and have to compare with B mhow to perform
i did
for n=1:4
Distance=EuD( ?,B)
end
plz tell what should be that question mark
finally i will have 4 distance values
please help

채택된 답변

Junaid
Junaid 2012년 2월 5일
Hi,
Similar question was asked.
I hope it will solve your problem.
%%%
let say you have matrix A as your query. so you convert A to col or row vector by:
A= A(:);
Now there are 10 matrices you make one matrix of them called B. Where each column represent your first matrix. then one simple command will get Euclidean distance of A with all in B
A= repmat(A,1,size(B,2));
E_distance = sqrt(sum((A-B).^2));
  댓글 수: 1
kash
kash 2012년 2월 5일
Thanks juniard, i have an image can u please tell how to find the centre region of that image

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with Image Processing Toolbox에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by