When the gui main program is running, I use findobj('Name', 'Gui_Main_Program');
This command does not work in timer callback function. It neither work in Matlab command window.
I see everyone says do not use global variables, so I put data in gui_main_hObject.UserData.
Thank you.

2 comentarios

Star Strider
Star Strider el 4 de Mzo. de 2020
The first argument to findobj must the the handle to the object you want to use it with.
Walter Roberson
Walter Roberson el 4 de Mzo. de 2020
No, https://www.mathworks.com/help/matlab/ref/findobj.html shows multiple syntaxes in which there is no object passed

Iniciar sesión para comentar.

 Respuesta aceptada

Walter Roberson
Walter Roberson el 4 de Mzo. de 2020

0 votos

Either there is no object with exactly that name, or else the handle of it is not visible.
What shows up for
get(findall('type', 'figure'), 'Name')

3 comentarios

Rocky Zhang
Rocky Zhang el 4 de Mzo. de 2020
It shows
Invalid handles passed to findall.
Where do I get or set whether the handle is visible?
I solved my problem by using a global variable.
Walter Roberson
Walter Roberson el 4 de Mzo. de 2020
get(findall(0, 'type', 'figure'), 'Name')
I keep forgetting that findall requires a first parameter
Rocky Zhang
Rocky Zhang el 5 de Mzo. de 2020
This one works.
Thank you Walter!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Creating, Deleting, and Querying Graphics Objects en Centro de ayuda y File Exchange.

Productos

Versión

R2018b

Etiquetas

Preguntada:

el 4 de Mzo. de 2020

Comentada:

el 5 de Mzo. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by