Revert to default interactivity in Figure/axes
4 views (last 30 days)
Show older comments
Hi ML gurus
I have a figure with axis which shows multiple plots, with extensive custom interactivity (I have custom-defined WindowButtonUpFcn, KeyPressFcn, DeleteFcn, WindowButtonMotionFcn, HitTest etc etc). Occasionally, I save the figure for a talk/presentation as a standalone matlab fig file. When saved as a standalone file, all the interactive callbacks like WindowButtonUpFcn are no longer functional, and I do not need that functionality anymore. However, the definitions remain, and when I try to use default matlab editing functions with the standalone plot (e.g. to change colors/thicknesses of lines, etc) I get numerous error messages, since the callbacks are no longer defined with the current variable space. I can write a scrtipt to pull out the data from the existing fig and to create a brand new one. But I wonder if would if it possible to revert all callblacks to their underfined states upon saving a figure instance?
Cheers!
0 Comments
Answers (1)
Rik
on 3 Feb 2022
(untested idea)
You could iteratively loop through the children objects of your figure, wiping all callback properties. That should reset the default behavior.
2 Comments
Rik
on 5 Feb 2022
I was proposing to write a function that does this. Shouldn't be very difficult. Would that suit your needs?
See Also
Categories
Find more on Interactive Control and Callbacks 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!