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 个)
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 中查找有关 Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!