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.6557
0.9134 0.9649 0.1419 0.0357
0.6324 0.1576 0.4218 0.8491
0.0975 0.9706 0.9157 0.9340
the first two columns are x and y values which get plotted as points via
plot(matrix(:, 1), matrix(:, 2), '*r'
Now what I want to work out is the following:
Whenever I click on a certain point in the plot, I want the information out of column 3 and 4 being displayed as text just right of the point in a box, e.g. with some text, e.g.
information 1: VALUE_COL3, information 2: VALUE_COL4
. How to achieve that? I thought of the ButtonDownFcn
attribute and than check out the clicked point and match it. But is there any easier way to do it?
Thanks!