How can I retrieve an exit code from a stand-alone created using MATLAB Compiler 4.10 (R2009a)?

조회 수: 21 (최근 30일)
I would like to execute the stand-alone from a batch file and do some processing according to the returned exit code.

채택된 답변

MathWorks Support Team
MathWorks Support Team 2016년 3월 8일
In order to return an exit code to the command interpreter, use the MATLAB function EXIT, as follows:
function hello
disp('hello');
exit(3) % Return exit code 3.
You will be able to access the exit code in the batch file through the variable %ERRORLEVEL%, however, in order for this to work, you will need to run the stand-alone using the Windows command "start" with the option /WAIT, as in the following example:
@echo off
start /WAIT hello.exe
echo %ERRORLEVEL%

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Manage Products에 대해 자세히 알아보기

제품


릴리스

R2009a

Community Treasure Hunt

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

Start Hunting!

Translated by