push button to change a variable
Afficher commentaires plus anciens
I guesss this is a very simple question, but I am spending more time searching for the answer, so I better ask here instead.
I made 3 pushbuttons, when I click on of them, a variable has to be changed, so like:
[Button1] when pressed: bp = sys
[Button2] when pressed: bp = mean
[Button3] when pressed: bp = dia
Thanks in advance
1 commentaire
Sven Schoeberichts
le 31 Jan 2012
Réponse acceptée
Plus de réponses (1)
bimal raj
le 31 Jan 2012
sorry i didnt see your comment
In this code kiessys = uicontrol( 'Position', [10 35 60 30],'String','Sys®','Callback','????' );
you are not setting the style property..
you can try this
h1=uicontrol('Style','text','position',[a b c d],'tag','text1','String','Sven');
push buttons may be created like this
h2= uicontrol('Style','pushbutton','String','Sys(R)','callback','pb1_callback','position',[a b c d]);
in the call back function 'pb1_callbck' add this code
set(findobj('tag','text1'),'String','bp=mean');
similarly you can create other push buttons and write the call back functions.
uicontrol handles also can be used for changing properties. matlab help contains many example programs
1 commentaire
Sven Schoeberichts
le 31 Jan 2012
Catégories
En savoir plus sur Programming dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!