Static Code Metrics - MATLAB & Simulink (original) (raw)

Main Content

Static Code Metrics

The code generator performs static analysis of the generated C or C++ code and provides these metrics in the Static Code Metrics Report section of the HTML Code Generation Report. When you place your cursor over a function or a variable in the generated code, you can also see metrics.

You can use the information in the report to:

For examples, see:

Static Code Metrics Analysis

Static analysis of the generated code is performed only on the source code without executing the program. The results of the static code metrics analysis are included in the Static Code Metrics section of the HTML Code Generation Report. The report is not available if you generate a MEX function from MATLAB code.

Static analysis of the generated source code files:

View Static Code Metrics and Definitions Within the Generated Code

When you view code in the Code view or in the code generation report, place your cursor over the global variables and functions to see code metrics information.

Generated code showing cursor hovering over rtDwork variable and box with code definition and code metrics details.

The tooltip provides a link to the definition for the variable or function.

Generated code showing highlighted line with declaration of rtDwork variable.

Static Code Metrics Report Limitations