MATLAB: How to display the value of a data point just by hovering the mouse over it in MATLAB 7.7 (R2008b)

MATLABtooltipstring

I would like to have a plot which allows me to simply hover over a point and have the coordinates of that point displayed. Data Cursor mode forces me to click to set the position of the cursor. I do not want to have to click anything.

Best Answer

This functionality is not available in MATLAB 7.7 (R2008b).
However, the functionality can be implemented through the use of a 'WindowButtonMotionFcn' function. Inside the function you can check the 'CurrentPoint' property of the axes to see where the mouse is, compare that point to the plotted points to determine which is closest, and then control a text object accordingly.
The attached file dataHover.m shows an example of how to do this.