I have some points like this:
matrix = rand(6, 4)
0.8147 0.2785 0.9572 0.7922
0.9058 0.5469 0.4854 0.9595
0.1270 0.9575 0.8003 0.6
MATLAB figures have a feature called data cursors. On the toolbar, there's a button that looks like a a blue curve, with a crosshair above it and a little tooltip. If you click this and then select one of the points you plotted, you'll get a little tooltip above the point giving some information about that point. You can double-click on the tooltip to pick it up, and rag it across to other plotted points.
By default, the tooltip displays simple information about the points, namely their X and Y coordinates. But you can customise the text displayed to whatever you want, by getting a handle to the datacursormode
object of the figure used for plotting, and setting its UpdateFcn
. The UpdateFcn
callback is executed to determine the text displayed on the tooltip - in your case it could get the corresponding values from the third and fourth columns of your matrix, splice them together with the string "information", and return that for display.
See this example in the documentation to see how that can be done in more detail.