How do I troubleshoot a MATLAB crash associated with a custom MEX function?

97 Ansichten (letzte 30 Tage)
While running my code MATLAB crashed and a technical support engineer mentioned the cause may have been a MEX function. How do I troubleshoot my MATLAB crash?

Akzeptierte Antwort

MathWorks Support Team
MathWorks Support Team am 16 Nov. 2023
Bearbeitet: MathWorks Support Team am 16 Nov. 2023
In order to troubleshoot your crash, first you need to determine which MEX function caused MATLAB to crash.  Depending on whether you are the author of this MEX function, you have multiple options to troubleshoot the MEX function.
 
Determine which MEX function caused MATLAB to crash
First, you need to obtain the latest crash log from MATLAB. Refer to the MATLAB Answers post below for information on locating the crash dump file (matlab_crash_dump.XXXX) MATLAB generates:
Once you have the crash log associated with your recent crash, refer to the following MATLAB Answers post to identify the MEX function that caused MATLAB to crash:
Out-Of-Process Execution of C++ MEX API Based Functions
If you are using C++ MEX API, you can run your MEX function in a process that is separate from the MATLAB process. Executing the MEX function in a separate process can prevent MATLAB from crashing if the MEX function crashes and can make it easier to troubleshoot MEX functions. Please refer to the following to learn more about Out-of-Process  execution of C++ MEX functions:
Please note that this feature is available only for C++ MEX API based functions and cannot be used with C MEX API based functions.
Please visit the following link to see how to create C++ MEX API based functions:
 
Troubleshoot the MEX function
Once you know which MEX function caused MATLAB to crash, there are two options depending on the authorship of the MEX function.
1. You are the author of the MEX function:
The documentation has resources for troubleshooting MEX functions. Please refer to the following documentation pages for more information on debugging MEX functions:
  • Introducing MEX functions
  • Troubleshooting MEX functions
2. You are not the author of the MEX function: 
Reach out to the original author of the MEX function regarding the issues you are experiencing. The original author may use the resources above to assist in troubleshooting the MEX function, or they may provide you with the source code so that you may troubleshoot the MEX function yourself.
If you are unable to utilize the information in the documentation to troubleshoot your custom MEX function, you can contact Technical Support for help on using the available resources for you to troubleshoot your MEX function.  Note that Technical Support can provide guidance on MEX setup issues, compilers, library dependencies and give general best practices for MEX function creation and debugging only.

Weitere Antworten (0)

Kategorien

Mehr zu Write C Functions Callable from MATLAB (MEX Files) finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by