how to click push button one by one without visible the button?

1 view (last 30 days)
Hi, i need some help about push button.
I have 3 push button then i need to make click the push button one by one, like if i click the first push button the second and third button cannot be work until the process in first push button done..
TQ

Answers (1)

Dennis
Dennis on 6 Mar 2019
You can use the enable property of a pushbutton.
for i=3:-1:1
h.pb(i)=uicontrol('style','pushbutton','position',[50 50+(40*i) 80 40],'String',sprintf('Button %d',i));
end
set(h.pb(:),'callback',{@MyCallback,h});
function MyCallback(hObj,~,h)
set(h.pb(:),'enable','off');
set(hObj,'Enable','On');
pause(3)
set(h.pb(:),'enable','on');
end

Categories

Find more on Interactive Control and Callbacks in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!