Create new figure with Update Datacursor

2 views (last 30 days)
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!
Thanks
UPDATE: if there is a solution that works but requires the use to reclick the pushbutton every time, it's totally fine.

Answers (0)

Categories

Find more on App Building in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!