Effacer les filtres
Effacer les filtres

delete drawn shape from image

6 vues (au cours des 30 derniers jours)
mary
mary le 2 Juin 2011
hi,
I have drawn several ellipses using imellipse instruction on an image in a figure. when i choose one of those ellipses and wanna delete it using 'delete' key, it doesn't work. how can i do it? tnx

Réponse acceptée

Walter Roberson
Walter Roberson le 2 Juin 2011
gco() should return the handle of the currently selected object. Selecting is just a matter of clicking (once) on the object. Recognizing the delete key would be done by setting KeyPressFcn callback for the figure: be sure to check the event data to be sure the proper key was pressed. It might also be a good idea to get() the Type of the current object and check it, so that you only delete the kind of objects you want.
  2 commentaires
Himanshu Giria
Himanshu Giria le 5 Jan 2021
Thank you
Himanshu Giria
Himanshu Giria le 5 Jan 2021
It worked

Connectez-vous pour commenter.

Plus de réponses (1)

Sean de Wolski
Sean de Wolski le 2 Juin 2011
H = imellipse(...);
delete(H);
  1 commentaire
mary
mary le 2 Juin 2011
tnx for your reply,
but i have loaded an image in a figure, and drawn more than one ellipses on it.now a user should select one of them and after pressing delete key it must be deleted.
i don't know how to write the code of selecting and getting the input key by user.
tnx

Connectez-vous pour commenter.

Catégories

En savoir plus sur Interactive Control and Callbacks dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by