Index of point in matlab plot

4 ビュー (過去 30 日間)
Arvind Kumar Pathak
Arvind Kumar Pathak 2019 年 5 月 20 日
コメント済み: KSSV 2019 年 5 月 20 日
x = rand(10,3);
plot3(x(:,1),x(:,2),x(:,3),'R.')
hold on
pause;
y = rand(10,3);
plot3(y(:,1),y(:,2),y(:,3),'B.')
%%%%
After ploting the x and y values, I want to click any point on the plot and it well give the information that perticular point lies in x matrix oy y matrix and tells the point no also respectively.

回答 (1 件)

KSSV
KSSV 2019 年 5 月 20 日
x = rand(10,3);
y = rand(10,3);
hold on
plot3(x(:,1),x(:,2),x(:,3),'R.')
plot3(y(:,1),y(:,2),y(:,3),'B.')
idx = knnsearch(x,y) ;
position_of_y = (1:size(y,1))' ;
nearest_of_y_in_x = idx ;
T = table(position_of_y,nearest_of_y_in_x) ;
text(y(:,1),y(:,2),y(:,3),num2str(position_of_y))
text(x(:,1),x(:,2),x(:,3),num2str(nearest_of_y_in_x))
  2 件のコメント
Arvind Kumar Pathak
Arvind Kumar Pathak 2019 年 5 月 20 日
What is table ?
T = table(position_of_y,nearest_of_y_in_x) ;
KSSV
KSSV 2019 年 5 月 20 日
It is kind of representing data. Read about it.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by