필터 지우기
필터 지우기

how to calculate closest points in a row matlab?

조회 수: 1 (최근 30일)
abdul wahab  aziz
abdul wahab aziz 2016년 8월 27일
댓글: Image Analyst 2016년 8월 27일
i have a row 0.7422 0.0436 1 0.6040 0.057
in this row i need to find closest distance from 3rd col point which is 0.6040 the ans should be 0.7422
  댓글 수: 2
Star Strider
Star Strider 2016년 8월 27일
The ‘third col point’ is actually 1, not 0.6040 which is the fourth, but the answer is the same regardless.
Image Analyst
Image Analyst 2016년 8월 27일
I'm not sure I understand the question. Do you want to
  1. find out which element has a value closest to the value of element 3, OR
  2. find out which pairs of elements have the smallest difference between their values?
Which one? Your subject line seems to indicate #2 but the body of your post seems to ask #1, so which is it? Or is it something else?

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

채택된 답변

Star Strider
Star Strider 2016년 8월 27일
One approach:
V = [0.7422 0.0436 1 0.6040 0.057];
idx = 3;
[~,Vidx] = min(abs(V(idx) - V(V~=V(idx))));
Out = V(Vidx)
Out =
0.7422

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by