having an issue in App Designer clearing plots
19 views (last 30 days)
Show older comments
J. Webster on 13 Apr 2016
Commented: Matthew Ward on 14 Jan 2021
In the application I'm developing, and I'd like to make it so that the data that is plotted will be based on which checkboxes are checked. The block of code that does this is below. My problem is that the clf doesn't clear the figure. Each time this code runs, then I get a new set of data plotted on top of the old set of data.
Am I doing something wrong?
plot(app.UIAxesDay, walknum, mpfv,'-o' );
plot(app.UIAxesDay, walknum, mst, '-o' );
plot(app.UIAxesDay, walknum, msd, '-o' );
ylim(app.UIAxesDay, [0 7]);
Mike Garrity on 13 Apr 2016
Well, clf probably isn't what you want anyways. It's job is to remove everything from a figure, and it sounds like you have checkboxes in the figure. It would also delete the axes that you've named UIAxesDay, and you'd need to create a new one.
I think that what you probably want is cla. It's job is to remove everything from an axes. You'd use it like this:
More Answers (0)
Find more on Graphics Performance 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!