how do i check if line in plot exists and if yes delete it otherwise nothing

20 visualizaciones (últimos 30 días)
I have GUI with some plots. and in the plot there migt be lines in it. and when i pres certain button i want to check if there are some lines in plot and if so delete them. if there arent any do nothing... Thanks for help!

Respuesta aceptada

Arthur el 6 de Nov. de 2012
Dirty way:
If you know the handle of the line:
if ishandle(line_handle)
if you don't know the line handle, use get(axeshandle,'Children') to find it.

Más respuestas (1)

Sonima el 24 de En. de 2019
I want to do the same, delete a line if exist in a plot in a fuction.
I used the suggeste code
if ishandle(line_handle)
But I got the error:
Undefined function or variable 'line_handle'.
How can I fix it?!


Más información sobre Graphics Object Identification en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by