Passing variables in matlab GUI

1 visualización (últimos 30 días)
Qiana Curcuru
Qiana Curcuru el 10 de Mzo. de 2020
Editada: Rik el 10 de Mzo. de 2020
In my GUI, i have a drop down menu, Yes or No. Depending on what is selected, determines the value of variable x. When I press a button, I want to use x to do a calculation
function [test]=popupmenu1_Callback(hObject, eventdata, handles)
end
function startbutton_Callback(hObject, eventdata, handles, test)
end
the popmenu by itself works, but when i press the start button, 'test' is not passed into it.

Respuestas (1)

Rik
Rik el 10 de Mzo. de 2020
Editada: Rik el 10 de Mzo. de 2020
You should store your variable in the guidata struct. That way you can easily share it across different callback functions.
I would also suggest moving away from GUIDE. See this discussion for more information.

Categorías

Más información sobre Migrate GUIDE Apps 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