Description of Matlab Windows Application exit codes

31 次查看(过去 30 天)
We created a simple test Windows application using Matlab Compiler. We are running it using command prompt with:
start /wait test.exe
and then getting the exit code with echo %errorlevel%. It works as expected.
By adding
quit(someNumber)
or
exit(someNumber)
to our code, echo returns someNumber, which is great.
But it seems that Matlab already has some 'reserved' exit codes for application crashes and we don't want to use the same exit code which Matlab itself already uses.
For example, by giving a path to a non existing file, application crashes and echo returns exit code 249.
Another example that we tried is trying to index an empty array. Application crashed and echo returned exit code 1.
Is there a list of Windows Matlab application exit codes with descriptions? Is there also a list of exit codes for when you are creating a Docker image for Linux OS?

回答(1 个)

Shivam Lahoti
Shivam Lahoti 2024-11-11,18:13
Hello Dora,
I understand that you are working with MATLAB Compiler-generated applications and are concerned about the exit codes returned, especially when errors occur. These exit codes can indicate different types of issues, and you're looking for guidance on which codes might be reserved by MATLAB to avoid conflicts with your custom exit codes.
MATLAB Compiler-generated applications can indeed return specific exit codes, especially when they encounter errors. I am not aware if any formal document exists detailing MATLAB-specific exit codes. However, here are some of the known exit codes:
  • 0: Indicates successful execution without errors.
  • 1: General error or exception. This is a common exit code for many applications, indicating an unspecified failure.
  • 249: Specific error, possibly related to file handling or path issues.
Regards,
Shivam

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by