Why does my code continue to execute, even after encountering an error message dialog generated by using the ERRORDLG function in MATLAB 7.0.1 (R14SP1)?

조회 수: 6 (최근 30일)
I use the ERRORDLG function to generate an error message inside my MATLAB scripts and functions as follows :
err_dlg = errordlg('string', 'title', 'modal');
I expect that after encountering the error message, MATLAB will stop executing the code and return to the calling function or script, as it does when the error message is generated using the ERROR function. I would like the code execution to stop once MATLAB encounters the error dialog.

채택된 답변

MathWorks Support Team
MathWorks Support Team 2009년 6월 27일
The ERRORDLG function only shows a message, without actually stopping the code execution.
If you would like to stop the code execution, use WAITFOR as follows:
err_dlg = errordlg('string', 'title', 'modal');
waitfor(err_dlg); % code execution is stopped till err_dlg is dismissed.
For further information about the WAITFOR function, type the following at the MATLAB Command Prompt:
doc waitfor

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

제품


릴리스

R14SP2

Community Treasure Hunt

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

Start Hunting!

Translated by