The Code Compatibility Report is a convenient tool that analyzes your code, lists the entire set of compatibility issues in tabular format, and provides you with instructions on how to address these compatibility issues. The report enables you to:
Identify the compatibility issues that you must address for your code to run properly in the current MATLAB® release.
Estimate the effort required to update your code when you upgrade to a newer MATLAB release.
Improve your code by replacing functionality that is not recommended.
The Code Compatibility Report displays the locations in your code that are affected by compatibility issues and provides links to the documentation for more information on how to make the necessary changes at each location.
To run the Code Compatibility Report:
In the Current Folder browser, navigate to and open the folder that contains the code files you want to analyze.
In the Current Folder browser that lists the files you want to analyze,
either click or right-click in the white space of the
browser. Both options open a menu. Select Reports > Code Compatibility Report. Alternatively, you can run
codeCompatibilityReport at the command prompt to generate
The report displays in the MATLAB Web Browser, showing potential compatibility issues. For example:
Update your code to resolve the syntax errors for each file listed in the Syntax Errors section. Syntax errors result in code that does not run. While most likely the code did not run properly in previous releases, syntax errors impact compatibility analysis. For example, Parse error at '}': usage might be invalid MATLAB syntax.
For each functionality listed in the report, review the issue description and your code. Messages include the line numbers to help locate the issue 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 Documentation link associated with the message.
Each functionality listed in the report displays a recommended action. You also can use the following general advice:
Functionality that has been removed — Update your code to avoid compatibility errors in the current release.
Functionality that has changed behavior — Confirm that the change in behavior is acceptable, and if not, update your code for the current release.
Functionality that will be removed — Update your code now or in a later release. Updating your code now makes future upgrades easier.
Functionality that will change behavior — Investigate these changes now to make future upgrades easier.
Functionality that is not recommended — Consider updating your code. The code is expected to continue working in future releases but uses functionality that is not recommended.
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
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