Borrar filtros
Borrar filtros

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

5 visualizaciones (últimos 30 días)
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 comentarios
Mahdi
Mahdi el 26 de Mzo. de 2013
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 el 26 de Mzo. de 2013
Hi Mahdi, I want to delete the polygon object inside the plot and not the plot itself.
Thanks
Viv

Iniciar sesión para comentar.

Respuesta aceptada

Walter Roberson
Walter Roberson el 26 de Mzo. de 2013
Use the figure KeyPressFcn or WindowKeyPressFcn callback. Test the received key. If it is the delete character, then delete() the object handle.
  8 comentarios

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Graphics Object Programming en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by