Checking for Run-Time Issues
Check for run-time issues by generating trial MEX function before generating production code
To check that your MATLAB® code produces generated code that works as expected, generate and execute a MEX function, which is executable and testable in the MATLAB environment. This step enables you to detect and fix run-time errors that are more difficult to diagnose in the generated production code. You can also verify that the generated code provides the same functionality as your original MATLAB function.
Functions
coder.runTest | Run test replacing calls to MATLAB functions with calls to MEX functions |
Topics
Generating Trial MEX Function
- Check for Issues in MATLAB Code Using MEX Functions
Use MEX functions to verify that the generated code provides the same functionality as the original MATLAB code. - Profile MEX Functions by Using MATLAB Profiler
See execution times and code coverage for generated MEX functions in MATLAB Profiler.
Debugging
- Debugging Strategies
Choose a strategy for detecting and correcting code that is not suitable for code generation. - Debugging Generated MEX Code
Debug MEX code generated from your MATLAB code. - Debug Generated C/C++ Code
Debug standalone C/C++ code generated from your MATLAB code.
Troubleshooting
- Resolve Error: Function Is Not Supported for Code Generation
Troubleshoot code generation failure of unsupported MATLAB functions. - Resolve Error: Variables Must Be Fully Defined Before Use
Troubleshoot code generation error when variables are not defined before use. - Resolve Issue: Cell Array Elements Must Be Fully Defined Before Use
Troubleshoot code generation errors when cell array elements are not defined before use.