how can i check if the axes handles exist or not ?

17 visualizaciones (últimos 30 días)
VBBV
VBBV el 5 de Ag. de 2018
Editada: VBBV el 6 de Ag. de 2018
I have GUI which has several pushbuttons. The pushbutton create handles to axes. I want to check if the specific handle or set of handles exist and then write necessary code whether to delete the handle or not ? how can I do it?

Respuesta aceptada

Jan
Jan el 5 de Ag. de 2018
Editada: Jan el 5 de Ag. de 2018
if isgraphics(handles.axes1)
In Matlab versions older than R2014b:
if ishghandle(handles.axes1)
I'd prefer ishghandle, because isgraphics accepts integer handles also, which is less reliable in my opinion.
  4 comentarios
Jan
Jan el 5 de Ag. de 2018
Editada: Jan el 5 de Ag. de 2018
It is not clear, what you expect ishandle(handle,'f1') to do. What is "handle"? Why do you expect ishandle to accept a second input argument called 'f1'? See: doc ishandle to see, that you do not use this command correctly. If it does not show an error, maybe you do not run the code at all?
Did you read my answer?
if isgraphics(handles.f1)
seems to be better.
VBBV
VBBV el 6 de Ag. de 2018
Editada: VBBV el 6 de Ag. de 2018
@Jan, yeah, ishandle() function has only ONE input argument and also isgraphics() works better than ishandle() ... it works fine now. thanks for the solution.

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.

Community Treasure Hunt

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

Start Hunting!

Translated by