Deleting a rectangle created in one function from another function

If I create a rectangle on an image from one function via:
function1(handles)
axes(handles.axes1);
hr=rectangle('Position',position,'EdgeColor','y')
How do I delete it from another function. I have tried both
function2(handles)
hl = findall(handles.axes1, 'type', 'line')
h2=( findobj(handles.axes1, 'type', 'line') )
delete(hl);
delete(h2)
drawnow
But both h1 & h2 are empty:
hl =
0×0 empty GraphicsPlaceholder array.
h2 =
0×0 empty GraphicsPlaceholder array.

1 件のコメント

Jason
Jason 2017 年 3 月 11 日
編集済み: Jason 2017 年 3 月 11 日
Done it.
hl = findall(handles.axes1, 'type', 'rectangle')

サインインしてコメントする。

 採用された回答

Jason
Jason 2017 年 3 月 11 日
編集済み: Jason 2017 年 3 月 11 日

0 投票

hl = findall(handles.axes1, 'type', 'rectangle')

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeEntering Commands についてさらに検索

質問済み:

2017 年 3 月 11 日

編集済み:

2017 年 3 月 11 日

Community Treasure Hunt

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

Start Hunting!

Translated by