How to make a forced exit from Matlab with returning a code?
조회 수: 15 (최근 30일)
이전 댓글 표시
Hi all, I try to exit from Matlab in a script and want to return a code to the command line. I know that there is the command
exit(code);
to do that. But in my case, some unsaved Simulink files prevent me from exiting. That's why I use
exit force;
to exit from Matlab without beeing asked to save the file first. But this command does not allow to pass a code to the command line. I tried something like
exit(code, 'force')
But that didn't work. Any other ideas?
Thanks a lot, Ralf
댓글 수: 0
답변 (2개)
yusra Ch
2018년 10월 26일
in the command window do this: ctrl+c and it will force the code to stop running
madhan ravi
2018년 10월 26일
편집: madhan ravi
2018년 10월 29일
exit %edited after sir Walter’s comment
댓글 수: 7
Walter Roberson
2018년 10월 29일
It turns out that although the two are documented differently, they take the same options. However, only one option is permitted; it must be 'force' or 'cancel' or a scalar integer (negative values are permitted.) It is possible that there are additional undocumented options.
참고 항목
카테고리
Help Center 및 File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!