Deleting a rectangle created in one function from another function

조회 수: 4 (최근 30일)
Jason
Jason 2017년 3월 11일
편집: Jason 2017년 3월 11일
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일
hl = findall(handles.axes1, 'type', 'rectangle')

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Entering Commands에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by