MATLAB: How to disable a button later in the program on gui

I want to disable the roll button of a dice,after the player of my snakes and ladders program,has landed on 100……what function can I use to disable the button???

Best Answer

%assuming you are using GUIDE and the button is called pushbutton1

set(handles.pushbutton1,'Enable','off')
After the code that rolls the dice finishes re-enable the button
%assuming you are using GUIDE and the button is called pushbutton1
set(handles.pushbutton1,'Enable','on')