Main Content

Using the Code Analyzer

You use the code analyzer in the MATLAB® Editor to check for code violations at design time, minimizing compilation errors. The code analyzer continuously checks your code as you enter it. It reports problems and recommends modifications.

To use the code analyzer to identify warnings and errors specific to MATLAB programming for code generation, you must add the %#codegen directive (or pragma) to your MATLAB file. A complete list of code generation analyzer messages is available in the MATLAB Code Analyzer preferences. For more information, see Open the Code Analyzer Report.


The code analyzer might not detect all code generation compliance issues in your MATLAB code. After eliminating the errors or warnings that the code analyzer detects, compile your code with MATLAB Coder™ to determine if the code has other compliance issues.