필터 지우기
필터 지우기

how to get value .if i know the coordinates value

조회 수: 2 (최근 30일)
singh
singh 2015년 4월 11일
답변: Image Analyst 2015년 4월 11일
suppose i create a network and all nodes are randomly plot on the graph.I know the coordinates value but how to get the particular node value at XY location. X=X1(1) it contain the X coordinate value Y=X1(2) it contain the Y coordinate value XY={X,Y}

답변 (1개)

Image Analyst
Image Analyst 2015년 4월 11일
Find the distance from your (x,y) coordinate location to all other node locations (let's say they're defined by variables named allX and allY), then use min() to find out which one is closest to your target (x,y) point:
distances = sqrt((x - allX) .^ 2 + (y - allY) .^ 2);
[minDistance, indexOfClosestNode] = min(distances);

카테고리

Help CenterFile Exchange에서 View and Analyze Simulation Results에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by