Matlab: How can I use the a center mouse button click to record/log the data shown by a datacursor? - matlab

I am new to using Matlab and I have just made my first custom datacursor for a scatter graph I have plotted. This datacursor shows me the x position, y position and the location of that point within the original matrix (row). I want to be able to call the datacursormode and then have a callback within the datacursor, so that pressing the center mouse button on the point it will log the point data shown by the datatip/cursor into a matrix or array.
The idea is to be able to click on a point of interest,see the data tip info and then if the user wants they can click on the point with the middle mouse button to log the data tip information displayed, then move straight to the next point, without re-calling the datacursormode. This should then result in a cell array/matrix of all the point information selected.
I have tried disp(pos) but this displays every point clicked and I want to be able to click on the point and see the info before deciding whether to log it or not. I have tried ginput but calling it disables datacursormode. I think a callback within the custom datacursor function is needed, but I can never get them to work.
Please help.
Thanks for any help you can give.

Related

Is there a way to make a scrollbar for plots in the matlab app designer?

I am building an app with the App Designer. The figure includes multiple plots that are synced. I would like to make something to scroll through the plots so that I can show a set amount of time at any given time. As it is now, it includes the ability to pan and zoom with just mouse controls. I cannot find a way to make such a scroll bar.
I was thinking of using the slider tool to keep re-plotting the plot based on where the slider begins, but that solution is very messy. And it could lead to some data never appearing.
Even if I could just make some way for me to set the plot to just show a given x interval (say 100 units of time) and use a key press to go to the next x interval without skipping anything.
Any help would be greatly appreciated!

Matlab GUI sliders: Change position directly to clicked point

Does any one know a way to change the behavior of Matlab sliders so that they move directly to the value you click on?
For instance, lets say a slider is initialized at zero (far left side). I'd like to able to click anywhere on the slider (including the far right side) and have the slider instantly move to that location. The way they normally work you'd have to click repeatedly to move the slider over to the right side one increment at a time, or hold down the right arrow.
I am running an experiment where subjects need to assign values for 420 sliders! It would speed things up a lot of each slider only required a single click.
Thanks,

Matlab Data cursor tip when hovering

Data cursor tips in matlab are immensely useful, but as far as I know you have to always click on the plot to apply them.
Is it possible to set it up so that they temporarily appear when you hover the mouse cursor over a data point, then dissappear when you move the mouse away? The reason I ask is that I often want to know the xyz of a point but don't want to add a data tip permanently

How to find mouse position on click in GTK window using Perl?

In my GTK+ application, I want to show an image and let the user click on it to draw lines. I'm doing this by generating a new image, with lines, with ImageMagick. This is my problem: How can I find out where the user clicked?
There is no way to find coordinates of click, because that signal does not have them. You have to use the button-press-event and button-release-event signals. Than the second argument to the callback is GdkEventButton object and that has coordinates.
You may want to see the example for the GtkDrawingArea widget, it does just that.

Mouse Handling in Matlab

Is there any way in matlab to do mouse event handling like click handling?
I need it to develop an application where I'm displaying an image in matlab's imshow.
Once user clicks at a particular point on image, I need to know co-ordinates of that point and use them for later processing.
To capture clicks, you have to define the ButtonDownFcn property of your IMAGE. The callback can then read the CurrentPoint property of the AXES and thus determine the coordinates.
Alternatively, you may want to have a look at GINPUT if you want the user to select a fixed number of points.