Code Verification
Behavioral verification of generated code, traceability, code generation reports
You can test the output of generated MEX code against the original MATLAB® code, or you can create custom tests based on the MATLAB unit test classes. You can choose to generate run-time error checks that alert you to errors that occur during code execution.
Functions
codegen | Generate C or C++ code from MATLAB code |
coder.config | Create code generation configuration objects |
coder.mfunctionname | Name of calling function or method (Since R2021b) |
coder.runTest | Run test replacing calls to MATLAB functions with calls to MEX functions |
Topics
Testing Generated Code
- Testing Code Generated from MATLAB Code
Verify numerical behavior of generated code. - Verify MEX Functions in the MATLAB Coder App
Compare results of running the original MATLAB function with the results from running the MEX function. - Verify MEX Functions at the Command Line
Test MEX functions withcoder.runTestor thecodegen-testoption. - Unit Test Generated Code with MATLAB Coder
Run MATLAB unit tests on generated code. - Unit Test External C Code with MATLAB Coder
Run MATLAB unit tests on generated code that integrates external C code.
Run-Time Error Detection
- Generate Standalone C/C++ Code That Detects and Reports Run-Time Errors
Generate standalone libraries and executables that detect and report run-time errors, such as out-of-bounds array indexing.
