필터 지우기
필터 지우기

Continue code with questionbox open

조회 수: 3 (최근 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 CenterFile Exchange에서 Dialog Boxes에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by