Deleting a rectangle created in one function from another function

2 Ansichten (letzte 30 Tage)
Jason
Jason am 11 Mär. 2017
Bearbeitet: Jason am 11 Mär. 2017
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.

Akzeptierte Antwort

Jason
Jason am 11 Mär. 2017
Bearbeitet: Jason am 11 Mär. 2017
hl = findall(handles.axes1, 'type', 'rectangle')

Weitere Antworten (0)

Kategorien

Mehr zu Images finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by