No products are associated with this question.
Here is a simple example that outlines how to do it using HITTEST.
function getcoords(varargin) this = hittest; if strcmp(get(this,'type'),'line'); cp = get(gca,'currentpoint'); ht = title(num2str(cp([1 3]))); set(ht,'color',get(this,'color')); end
datacursormode() with a custom callback function that sends the coordinate to the edit box as well as displaying it on the screen.
You can use the WindowsButtonMotion function of the parent figure. There OVEROBJ can check, if the mouse is over the specified axes and the CurrentPoint property of this axes contains the coordinates. Now you need a method to find the nearest (interpolated?) point of your data for the display.
Play games and win prizes!Learn more