MATLAB Code Compatibility Report

Generate the Code Compatibility Report

The Code Compatibility Report displays potential compatibility issues in your code. This report helps identify potential compatibility issues in your existing 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:

  1. In the Current Folder browser, navigate to the folder that contains the code files you want to analyze.

  2. 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:

  3. 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.

  4. 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.

Programmatic Use

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.

See Also

| |