필터 지우기
필터 지우기

how to display connection?

조회 수: 3 (최근 30일)
ker fang fang
ker fang fang 2015년 3월 22일
댓글: ker fang fang 2015년 3월 22일
hi, i have a situation like this. x1=10, x2=15,x3=30. i need to check whether x1 is connected to x2 and whether x1 is connected to x3. if the distance between them is less than 10, then they are connected. i need a feedback like 'x1 and x2 are connected', or x1 and x3 are not connected. assuming i have a lot of points to check, how should i do it?

답변 (1개)

Roger Stafford
Roger Stafford 2015년 3월 22일
I can give you a few ideas. If the x values were all elements of a single vector, you could use for-loops to make comparisons between each pair of values in the vector. There is also a way of using 'bsxfun' to make the same comparisons in a vectorized manner. However, finally, if the elements in this vector were placed in ascending order it would not really be necessary to compare every possible pair. With fewer comparisons you could deduce all the rest. Does this succeed in giving you ideas?
  댓글 수: 2
ker fang fang
ker fang fang 2015년 3월 22일
can u show me some example on how to use bsxfun? by just putting a few points,maybe 20 points and the points are in random manner?thank you.
ker fang fang
ker fang fang 2015년 3월 22일
if using for loop, how can i do it?

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

카테고리

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