Get the index with the values in matlab plot
25 views (last 30 days)
Show older comments
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 ?
0 Comments
Answers (2)
Walter Roberson
on 6 Apr 2020
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
0 Comments
See Also
Categories
Find more on Visual Exploration in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!