Finding the Euclidean Distance

조회 수: 2 (최근 30일)
Pat
Pat 2012년 12월 29일
I have values as
data2 =
[20x480 double] [20x480 double] [20x480 double] [20x480 double]
{ 1x8 cell } { 1x8 cell } { 1x8 cell } { 1x8 cell }
data1 =
[20x480 double]
{ 1x8 cell }
i want to match data2 and data1 by euclidean distance and if same values are present i want to display it,plz help
  댓글 수: 1
Matt J
Matt J 2012년 12월 29일
편집: Matt J 2012년 12월 29일
What's in the 1x8 cells?
What do you want displayed? The data? The column numbers of data2 which agree with data1?
When are the values considered "the same"? When the Euclidean distance = 0 precisely or is there some tolerance>0? If the tolerance=0, why care about the Euclidean distance at all? Why not just use ISEQUAL, as in my Answer below?

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

채택된 답변

Matt J
Matt J 2012년 12월 29일
find(arrayfun(@(i) isequal(data2(:,i),data1), 1:size(data2,2) )),
  댓글 수: 8
Pat
Pat 2013년 1월 3일
if data1 has different values i get empty matrix
i want to display data is present ,how can i check the answer if it is empty matrix or not and display it
so how i can display it as "data is present".
Walter Roberson
Walter Roberson 2013년 1월 3일
isempty()

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by