How to clear Panel of contents (Axes)

9 views (last 30 days)
Jordan
Jordan on 17 Oct 2023
Edited: Jordan on 17 Oct 2023
Apologies in advance, a lot of words for a fairly basic question;
TL;DR - How can I clear the contents of the Panel, so that when I re-run the plotting function, the old set of axes are deleted and replaced with the new set?
I'm using app designer to build a GUI that allows users to import data, select variables and plot them onto a chart. I'm using PlotNy to allow for multiple Y axis labels/values, as this is not native to Matlab. PlotNy generates a figure with multiple overlapping axes (one per variable), and offsets the Yaxis labels/values to fit.
The problem I have is that when I re-run the function that plots the data, a new set of axes appear on top of and offset from the original axes. This is expected behaviour as I have not cleared or deleted the contents of the Panel. I have tried to CLA the Panel, its Children and even the axes directly, however none of these approaches have worked.
How can I clear the contents of the Panel, so that when I re-run the plotting function, the old set of axes are deleted and replaced with the new set?

Accepted Answer

dpb
dpb on 17 Oct 2023
Moved: dpb on 17 Oct 2023
delete the objects desired using their handles

More Answers (0)

Categories

Find more on Language Fundamentals in Help Center and File Exchange

Products


Release

R2023b

Community Treasure Hunt

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

Start Hunting!