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

7 ビュー (過去 30 日間)
Jakub
Jakub 2012 年 11 月 6 日
回答済み: Sonima 2019 年 1 月 24 日
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!

採用された回答

Arthur
Arthur 2012 年 11 月 6 日
Dirty way:
cla(axes_handle)
If you know the handle of the line:
if ishandle(line_handle)
delete(line_handle)
end
if you don't know the line handle, use get(axeshandle,'Children') to find it.

その他の回答 (1 件)

Sonima
Sonima 2019 年 1 月 24 日
Hi!
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)
delete(line_handle)
end
But I got the error:
Undefined function or variable 'line_handle'.
How can I fix it?!

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by