MATLAB Answers


Create new figure with Update Datacursor

Asked by Paolo Bocchini on 7 Jul 2015
Latest activity Edited by Paolo Bocchini on 7 Jul 2015
Hi, I have a GUI with some axis and a button. When I click the button, I want to go in datacursormode, let the user click on a point, and plot a new figure based on the point that he clicked. I did so using a custom UpdateFcn. The problem is that after creating and plotting the new figure, the GUI remains stuck in datacursormode, and even if I don't click, just hovering on other points creates 1000 figures (minimum working example is attached). I tried all the possible combinations of re-enabling and disabling datacursormode, but it doesn't work.
The thing gets even weirder. On some computers, this issue appears, in others it doesn't. But when I compile the code, the issue appears on every machine. Even if I compile it on a machine that did not present the issue. This seems also a serious bug of the compiler.
I have a minimum working example attached (compiled and source, run mwe.m). This thing is really killing me. Any help will be much appreciated!
UPDATE: if there is a solution that works but requires the use to reclick the pushbutton every time, it's totally fine.


Sign in to comment.

0 Answers