Code Generation Readiness Tool
The code generation readiness tool screens MATLAB® code for features and functions that code generation does not support. The tool provides a report that lists the source files that contain unsupported features and functions. The report also indicates the amount of work required to make the MATLAB code suitable for code generation. It is possible that the tool does not detect all code generation issues. Under certain circumstances, it is possible that the tool can report false errors. Therefore, before you generate C code, verify that your code is suitable for code generation by generating a MEX function.
The code generation readiness tool does not report functions that the code generator
automatically treats as extrinsic. Examples of such functions are
figure. See Use MATLAB Engine to Execute a Function Call in Generated Code.
The Code Generation Readiness Tool is not supported in MATLAB Online™.
The Summary tab provides a Code Generation Readiness
Score, which ranges from
1 indicates that the tool detects issues that require
extensive changes to the MATLAB code to make it suitable for code generation. A score of
5 indicates that the tool does not detect code generation issues;
the code is ready to use with minimal or no
On this tab, the tool also displays information about:
MATLAB syntax issues. These issues are reported in the MATLAB editor. To learn more about the issues and how to fix them, use the Code Analyzer.
Unsupported MATLAB function calls.
Unsupported MATLAB language features.
Unsupported data types.
Code Structure Tab
If the code that you are checking calls other MATLAB functions, or you are checking multiple entry-point functions, the tool displays the Code Structure Tab.
This tab displays information about the relative size of each file and how suitable each file is for code generation.
The Code Distribution pane displays a pie chart that shows the relative sizes of the files and how suitable each file is for code generation. During the planning phase of a project, you can use this information for estimation and scheduling. If the report indicates that multiple files are not suitable for code generation, consider fixing files that require minor changes before addressing files with significant issues.
The Call Tree pane displays information about the nesting of
function calls. For each called function, the report provides a Code
Generation Readiness score, which ranges from
5. A score of
1 indicates that the tool
detects issues that require extensive changes to the MATLAB code to make it suitable for code generation. A score of
5 indicates that the tool does not detect code generation
issues. The code is ready to use with minimal or
no changes. The report also lists the number of
lines of code in each file.
Show MATLAB Functions. If you select Show MATLAB Functions, the report also
lists the MATLAB functions that your function calls. For each of these MATLAB functions, if code generation supports the function, the report
sets Code Generation Readiness to