MATLAB Code Analysis
Successful C/C++ code generation from MATLAB code depends on compliance with code generation rules and limitations. For example, your MATLAB code must only use MATLAB functions and toolbox functions supported for code generation. To identify and fix issues with your MATLAB code, prior to C/C++ code generation, you can use the Code Analyzer and Code Readiness Tool. 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.
MATLAB Code Analysis Basics
Prepare MATLAB code for C/C++ code generation or code acceleration.
Fix errors detected by the code analyzer.
Fix errors and warnings listed in the code generation report.
Choose a strategy for detecting and correcting code that is not suitable for code generation.
Accelerate your MATLAB function or test generated code for functionality and run-time issues.
Debug standalone C/C++ code generated from your MATLAB code.
Code Readiness Tool
Interpret code generation readiness tool report.
The app screens your MATLAB code for unsupported features and functions.
Run the code generation readiness tool at the command line, from the current folder browser, or in the app.
MEX Function Testing
Test MEX functions before generating C/C++ code.
Test a MEX function to verify that it provides the same functionality as the original MATLAB code.
Follow the workflow for generating MEX functions with the MATLAB Coder™ app.
Follow the workflow for generating MEX functions with
Detect and fix issues that are harder to find in generated standalone C/C++ code.
Call a MEX function in the same way that you call the original MATLAB function.
See how well your test exercises MEX code generated from your MATLAB code.
Debug issues with generated MEX functions.
The code generation readiness tool fails when it is unable to find your entry-point files.
Use a backup project file to revert to the format of an earlier release.
Disable code generation readiness screening.
Troubleshoot code generation failure of unsupported MATLAB functions.