accessing a set of axes from different callback functions in a gui

1 view (last 30 days)
I am developing a GUI in which we have different push buttons that generate wave forms to be displayed on to same set of axes. how can this be done.

Accepted Answer

Adam
Adam on 5 Aug 2014
If your axes are an integrated part of your GUI then you can just get them via handles and their tag under each push button, ensuring you use 'hold on' status.
If you are spawning a new figure first time then you just need to store the axes associated with the figure the first time you open it.
e.g.
figure; handles.hAxes = gca;
the first time you launch the figure from a callback. Then in any other callback you can just plot on handles.hAxes.
If you don't know which callback would be called first and spawn the figure then you'd have to do a bit more and store an initially empty figure handle on your GUI's handles struct, then check each time you want to plot and if that handle is still empty spawn a figure first.

More Answers (0)

Categories

Find more on Interactive Control and Callbacks in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!