how to know the node number if i know the coordinates values
조회 수: 1 (최근 30일)
이전 댓글 표시
i have 100 nodes and plot on the graph randomly.each node are identify uniquely by node number.
I know the coordinate value of each node but i don't know the node number.
How to get the node number at particular X and Y coordinates
suppose i have value of X and Y is
X=42.3109 Y=21.2031
댓글 수: 2
Guillaume
2015년 4월 13일
How are the nodes stored? Is it an N x 3 matrix where the columns are node number, x and y? Or something else?
Are the coordinates also stored rounded to 4 decimals or are they infinite precision? That will influence the way the coordinate search is performed.
답변 (1개)
Guillaume
2015년 4월 13일
It's not very clear what you are asking. Assuming you have an N x 3 matrix of nodes, x and y coordinates as such:
nodes = [1 15.2345 23.7891
2 23.1496 47.2365
3 42.3109 21.2031
4 16.7845 21.2031
5 42.3109 47.2145]; %column 1 = node number, 2 = x, 3 = y. rows are nodes
To find the node number for a given coordinate:
x = 72.3109;
y = 21.2031;
nodenumber = nodes(nodes(:, 2) == x & nodes(:, 3) == y, 1)
Note that this assumes that all numbers have been rounded to four decimals. Otherwise the comparison might fail if you obtained what is mathemically the same number through two different operations. Be aware that with floating point numbers (0.1 + 0.1 + 0.1) == 0.3 is false.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Annotations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!