필터 지우기
필터 지우기

how to delete an object in a plot using the delete button in keyboard

조회 수: 5 (최근 30일)
Hi all,
I want to delete an object I created in a plot using the delete button. I created a GUI with a plot plotting a figure as described by the following:
t = 0:pi/5:2*pi;
figure
patch(sin(t),cos(t),'y')
axis equal
Now how should I delete it using the delete button?
Thanks
Viv
  댓글 수: 2
Mahdi
Mahdi 2013년 3월 26일
What do you want to delete? Do you want to delete the whole plot? Close the figure?
Why do you want to use the delete button? Why not close, or alt+F4?
Vivekram
Vivekram 2013년 3월 26일
Hi Mahdi, I want to delete the polygon object inside the plot and not the plot itself.
Thanks
Viv

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2013년 3월 26일
Use the figure KeyPressFcn or WindowKeyPressFcn callback. Test the received key. If it is the delete character, then delete() the object handle.
  댓글 수: 8
Vivekram
Vivekram 2013년 3월 27일
Awesome... Thanks Walters

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Graphics Object Programming에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by