フィルターのクリア

callback function after button didn't work

2 ビュー (過去 30 日間)
Pan
Pan 2012 年 8 月 12 日
If I have a button that can callback a function then , when I call the functin ,the button must didn't work five miment,over five miment the button also can work.
how to do?
If you can tell me, thanks!!
  2 件のコメント
Tom
Tom 2012 年 8 月 12 日
Do you mean minutes? and if so, 5 minutes after what?
Walter Roberson
Walter Roberson 2012 年 8 月 12 日

サインインしてコメントする。

回答 (2 件)

Image Analyst
Image Analyst 2012 年 8 月 12 日
If you used a pause() to wait the 5 minutes, I believe that would lock up your whole app for that time. No interaction could take place with any of the other controls during that waiting time. I don't think that's what you want, but maybe it is.
If you want to disable just that one button, and still allow the user to interact with other buttons and things on your GUI, then you could set up a timer. Disable the button, then start the timer. You can interact with any of the other controls, then after 5 minutes when the timer fires off its callback, the timer callback would enable the button with the set() command.
set(handles.button, 'Enable', 'on');

Azzi Abdelmalek
Azzi Abdelmalek 2012 年 8 月 12 日
編集済み: Azzi Abdelmalek 2012 年 8 月 12 日
you have to program this function
function button_name(hObject,Event)
val = get(hObject,'Value');
if val ==1
% do whatever you want
set(hObject,'enable','off')
pause(5*60) % paused for 5 minutes
set(hObject,'enable','on')
end

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by