Borrar filtros
Borrar filtros

Loading data from gui to a function

1 visualización (últimos 30 días)
Milad Javan
Milad Javan el 24 de Sept. de 2011
I made a GUI for my project. When I press start push button a timer start working. It execute a function named "update.m" each second. I need to change GUI elements properties (like edittext, text, pop up menu ,...) in update.m function routine but I don't have access to handles variable.
What should I do? can I use assignin function? What is function caller?

Respuestas (2)

Fangjun Jiang
Fangjun Jiang el 24 de Sept. de 2011
In the callback function of your push button, you have access to the handles. Pass this handles to update.m

Walter Roberson
Walter Roberson el 24 de Sept. de 2011
I wouldn't pass the handles structure if you are using it to carry data that is not just object handles (and the object handles are not going to change.)
The more general method is to instead pass the GUI figure handle to the update call, such as
timer('Callback', {@update, GuiFigureNumber}, ....)
Then,
function update(FigureNumber)
handles = guidata(FigureNumber);
...
end

Categorías

Más información sobre Introduction to Installation and Licensing 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