i think the answer is easy but i'm new in MATLAB world.. i have two buttons if the user press any of them the Value of I1 will change.
this is my function:
function PU = testfunI1=0;B1=uicontrol('Style',... 'pushbutton',... 'String',' 1 ',... 'Position',[10 350 100 30],... 'HandleVisibility','on',... 'Callback',@PushB1);B2=uicontrol('Style','pushbutton',... 'String',' 2 ',... 'Position',[10 150 100 30],... 'HandleVisibility','on',... 'Callback',@PushB2);function PushB1(~,~) I1=1;endfunction PushB2(~,~) I1=2;end end
And here is the script :
GS=20;PU = testfunif I1 ==1 GS=GS-5;endif I1 ==2 GS=GS-10;end
I DID TRY GLOBAL BUT IT DID NOT WORK. thank you.
Best Answer