How to clear Panel of contents (Axes)

10 次查看(过去 30 天)
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?

采纳的回答

dpb
dpb 2023-10-17
移动:dpb 2023-10-17
delete the objects desired using their handles

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Language Fundamentals 的更多信息

产品


版本

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by