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 个评论

请先登录,再进行评论。

更多回答(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