How do you clear a GUI figure in appdesigner?

Two issues related to Matlab 2016B:
1. How do you reset an appdesigner figure to initial properties? (Such as provided by the 'clf' function for regular figures.
2. In particular, the following code does not work for turning off legends in appdesigner figures. The legend property is also a read only property. Multiple legends appear if I plot two sets of data in a row without clearing the figure in between.
legend( AxesHandle, 'off');

1 Comment

CLF is not supported by App Designer UIFigures in 16b. The list of functions supported in 16b are available here:
https://www.mathworks.com/help/matlab/creating_guis/graphics-support-in-app-designer.html
I'd need to see more of your code to see if there is a workaround or suggestion to offer for #1.
For #2, if AxesHandle is a handle to a UIAxes, the syntax you describe is expected to work. I'd have to see more of the code to understand why it may not be working.

Sign in to comment.

 Accepted Answer

you can use the cla function eg.
app.UIAxes.cla;

More Answers (0)

Categories

Find more on Update figure-Based Apps in Help Center and File Exchange

Asked:

on 3 Nov 2016

Commented:

on 28 Sep 2020

Community Treasure Hunt

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

Start Hunting!