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 で Logical についてさらに検索
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
