フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

How can pushbutton2 control the ' while (pushbutton has been pressed down) in pushbutton_callback() ?

2 ビュー (過去 30 日間)
Lisa Wu
Lisa Wu 2013 年 2 月 18 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
In a GUI produced by GUIDE ,there are two pushbutton, pushbutton1 and pushbutton2;
The M script a follows:
function pushbutton1_callback()
...
n = 1; %%stop here and wait for pushbutton be pressed down
while(ispressed)
...
n = n+1;
end
function pushbutton2_callback()
ispressed = 1;
I hope it can work like this:
first , press down pushbutton1,when it goes to n = n+1 ,stop and wait for pushbutton2 be pressed down;
second, press down pushbutton2 ,continue while(ispressed) in pushbutton1_callback();
third, I can press down the pushbutton2 for many times while once for pushbutton1,so the n can get to 10 or larger.
Thank you!

回答 (1 件)

Jan
Jan 2013 年 2 月 18 日
When a pushbutton is pressed, the user cannot apply any further mouse clicks before it is released. Therefore your idea of "ispressed" cannot work.
Do you mean toggle-buttons? Please explain the problem again, preferably by editing the original question and not as comment or answer.

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by