The Code Compatibility Report displays potential compatibility issues in your code. This report helps update your code when you upgrade to a newer MATLAB® release. For example, the report tells you when you use discouraged or removed functions or invalid syntaxes in your code. After you upgrade to a newer version of MATLAB, you can use this report to identify potential compatibility issues in your existing code.
To run the Code Compatibility Report:
In the Current Folder browser, navigate to the folder that contains the code files you want to analyze.
In the Current Folder browser, either click or right-click the white space. Then select Reports > Code Compatibility Report.
The report displays in the MATLAB Web Browser, showing potential compatibility issues. For example:
For each message in the report, review the issue description and your code. Messages include the line numbers to help location the issues in your code. To open the file in the Editor at that line, click the line number. Then change the file based on the message. If you are unsure what a message means or what to change in the code, click the Details link associated with the message. Use the following general advice:
Syntax Errors—Update your code to correct the error. Syntax errors result in code that does not run. While they are not introduced with a new version of MATLAB, syntax errors impact compatibility analysis. For example, Parse error at '}': usage might be invalid MATLAB syntax.
Incompatibility Errors—Update your code to work in the current release. Incompatibility errors indicate that functionality has been removed. For example, 'wavfinfo' has been removed. Use 'AUDIOINFO' instead.
Incompatibility Warnings—Update your code now or in a later release. Incompatibility warnings indicate that functionality will be removed in a future release. For example, 'aviinfo' will be removed in a future release. Use 'VideoReader' instead.
Suggested Improvements—Consider updating your code. The code is expected to continue working in future releases but uses functionality that is not recommended. For example, Programmatic use of DISPLAY is not recommended. Use DISP or FPRINTF instead.
The Code Compatibility Report also includes information about the checks performed on your code and the list of files that MATLAB analyzed for code compatibility.
When you generate a Code Compatibility Report through the current folder browser, MATLAB analyzes code in the current working folder and subfolders. However, if you generate a report programmatically, you can specify particular files to analyze or to exclude subfolders from analysis. To generate a report programmatically, use one of the following methods.
To generate a report that opens in the MATLAB® Web Browser programmatically, use the codeCompatibilityReport
function.
To return a CodeCompatibilityAnalysis
object that contains the report information, use the analyzeCodeCompatibility
function. You can then display a report for the stored object using the codeCompatibilityReport
function.
CodeCompatibilityAnalysis
| analyzeCodeCompatibility
| codeCompatibilityReport