フィルターのクリア

Continue code with questionbox open

2 ビュー (過去 30 日間)
Fontys
Fontys 2013 年 4 月 18 日
Hi,
For a project I need a simple concept: While a questionbox is open, I need to continue running the code.
The basic idea is this:
y=questbox('Do you want to quit the while loop?')
while y~=('Yes')
disp('Useful code here')
end
But, ofcourse, this code will pause when the questionbox is called. Is there a way this doesn't happen but that the question could still affect the rest of the code?
Thanks in advance
  2 件のコメント
Sean de Wolski
Sean de Wolski 2013 年 4 月 18 日
But how could this work? What is the point of the question box since you would either have to predefine y, and this is the y that will be used or it will error for no variable y.
What are you trying to do?
Fontys
Fontys 2013 年 4 月 18 日
The end result must be that as long as there is no answer given, the while loop keeps looping.

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

採用された回答

Walter Roberson
Walter Roberson 2013 年 4 月 18 日
No, you cannot do this with questbox()
  2 件のコメント
Fontys
Fontys 2013 年 4 月 18 日
Is there a way I can do this in another setting? With a dialog box or something?
Walter Roberson
Walter Roberson 2013 年 4 月 18 日
Create a pushbutton, say handles.stopbutton . Then at the place you have the questbox and "while" in your code, change it to
set(handles.stopbutton, 'Enable', 'on')
while true
drawnow();
if get(handles.stopbutton, 'Value') > 0; break; end
disp('USeful code here');
end
set(handles.stopbutton, 'Value', 0, 'Enable', 'off');

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDialog Boxes についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by