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
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 Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기

태그

질문:

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