How not to delete one element of a figure when using cla?
Mostrar comentarios más antiguos
I have a map with coastlines and sampling stations that are added from other scripts using the command plot. When I move on to the next data set, I need to initialize the plot. What I want specifically is to keep the coastline plots (handle 'h' as below), but clear everything else (e.g., the sampling stations plotted on the map).
cla(app.mapPlot2);
h = patch(app.mapPlot2, M2(:,1), M2(:,2), [0.62,0.83,0.50]);
My current program as above would delete everything including coastalines. Is there a way I can delete everything but the 'h' handle?
Many thanks!
Respuesta aceptada
Más respuestas (1)
Stijn Haenen
el 8 de Feb. de 2020
Maybe you can delete one of the 'Children' of the figure.
type:
h.Children
and check if there is any data that can be deleted.
or
h.Children.Children
1 comentario
Leon
el 8 de Feb. de 2020
Categorías
Más información sobre Creating, Deleting, and Querying Graphics Objects en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!