Get the index with the values in matlab plot

This is my code
view(65,0) % YZ
X = rri_0_0(1:3,:)'; %%%% data is attached
[index,tnorm]=MyRobustCrust(X);
trisurf(index,X(:,1),X(:,2),X(:,3),'facecolor','y','edgecolor','b')%plot della superficie trattata
I am using Matlab 2018b
When i put my cursor an any point in matlab plot, it gives me the coordinates of that point.
I want the index of that point in matlab plot ?

回答 (2 件)

madhan ravi
madhan ravi 2019 年 1 月 4 日

0 投票

help ginput
help getpts

1 件のコメント

Arvind Kumar Pathak
Arvind Kumar Pathak 2019 年 1 月 4 日
can you explain this with reference to my code

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

Walter Roberson
Walter Roberson 2020 年 4 月 6 日

0 投票

The basic technique is to take the data coordinates you get back, and calculate the distance to all coordinates in the graphics and find the nearest one and say that is the one you want the coordinates for.
However if you use data cursor with a line plot then you can get the index directly. This would not apply for a mesh plot such as trisurf.
https://www.mathworks.com/help/matlab/ref/matlab.graphics.shape.internal.datacursormanager.html
I have not investigated the newer interactive charts facilities; there is a link to those in the data cursor document

カテゴリ

ヘルプ センター および File ExchangeData Exploration についてさらに検索

タグ

質問済み:

2019 年 1 月 4 日

回答済み:

2020 年 4 月 6 日

Community Treasure Hunt

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

Start Hunting!

Translated by