GUI of the button
1 次查看(过去 30 天)
显示 更早的评论
Hi, I want to ask about button.
If the button want to be use once ,then the button couldn't be use,
anyway, button is used once,not twice or three times,
So, how to set the button for code.
Teach me, thank you!
0 个评论
采纳的回答
Sean de Wolski
2012-8-8
In its callback, disable it after it's pushed:
figure;
uicontrol('string','Push Me!','position',[10 10 100 50],'callback',@(src,evt)set(src,'enable','inactive','string','Now you can''t'));
4 个评论
Sean de Wolski
2012-8-8
So play1_callback will automatically receive two inputs: src, the handle the button calling it and event which contains some event data or can be empty.
Above, I took the handle and set it's enable property to off and changed the string to show it happened. In your play1_callback, the first line should read:
set(src,'enable','inactive') %or 'off'
Alternatively, you could just make the button invisible if you wanted. 'visible','off'
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Migrate GUIDE Apps 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!