Main Content

codeCompatibilityReport

Create code compatibility report

Description

example

codeCompatibilityReport creates a code compatibility report for the current working folder and subfolders. The code compatibility report opens in the MATLAB® Web Browser. After you upgrade to a newer version of MATLAB, you can use this report to identify potential compatibility issues in your existing code.

A list of all checks performed by the MATLAB Code Analyzer, including checks for compatibility issues, can be found here, Index of Code Analyzer Checks.

codeCompatibilityReport(names) creates a report for the files or folders specified by names.

codeCompatibilityReport(___,'IncludeSubfolders',tf) specifies whether to report on subfolders. By default, subfolders are included in the analysis. Use this syntax with any of the arguments in previous syntaxes.

example

codeCompatibilityReport(cca) creates a report from an existing code compatibility result, specified as a CodeCompatibilityAnalysis object.

Examples

collapse all

Use codeCompatibilityReport to generate a code compatibility report.

codeCompatibilityReport

This command launches the Code Compatibility Analyzer app and generates a report of compatibility issues found within the specified code. The summary section at the top of the report provides an overview of the information contained in the report. This section shows how many files were analyzed and the total number of errors, warnings, and informational messages found in the analyzed code.

Code Compatibility Analyzer app

The Code Compatibility Analyzer generates information to help you upgrade your code to the latest version of MATLAB. It contains these issue types.

  • Syntax errors — Table with details about syntax errors. Syntax errors result in nonrunnable code, and while they are not introduced with a new version of MATLAB, syntax errors impact compatibility analysis.

  • Functionality that has been removed — Table with details about functionality used in the analyzed code that has been removed. For example, 'wavfinfo' has been removed. Use 'audioinfo' instead.

  • Functionality that has changed behavior — Table with details about functionality used in the analyzed code that has changed behavior. For example, 'legend' has changed and might interpret the name of an argument as a legend property instead of a label. To include a label with the same name as a legend property, specify the labels using a cell array or string array. Refer to the documentation for a list of affected property names.

  • Unsupported functionality that might cause errors — Table with details about functionality that is unsupported, undocumented, and not intended for use. Update your code to use documented functionality because unsupported functionality can cause errors and unexpected behavior changes. For example, 'awtinvoke' is unsupported and might have been changed or removed without notice. With appropriate code changes, use javaMethodEDT instead.

  • Functionality that will be removed — Table with details about functionality used in the analyzed code that will be removed in a future release. For example, 'aviinfo' will be removed in a future release. Use 'VideoReader' instead.

  • Functionality that will change behavior — Table with details about functionality in the analyzed code that will change behavior in a future release. For example, 'interp1(...,'cubic')' will change in a future release to perform cubic convolution. To continue using shape-preserving piecewise cubic interpolation, use 'interp1(...,'pchip')' instead.

  • New functionality that might improve code — Table with details about new functionality. Consider updating your code. Current code is expected to continue working in future releases, but newer functionality is recommended. For example, Programmatic use of DISPLAY is not recommended. Use DISP or FPRINTF instead.

Issues are grouped by Issue Type by default. You can change how issues are grouped by using the Group By list. Group the report by file.

Code Compatibility Analyzer report grouped by file.

You can filter the displayed messages by using the Filter by Severity and Filter by Issue Type lists. Filter the report to show only warnings.

Code Compatibility Analyzer report filtered by severity

Create a code compatibility report for code in your current folder and subfolders. The report opens in the MATLAB Web Browser.

codeCompatibilityReport

Create another report, but omit subfolders from the analysis.

codeCompatibilityReport('IncludeSubfolders',false)

Generate compatibility analysis results for code in your current working folder and subfolders.

r = analyzeCodeCompatibility;

Create a report from the results. The report opens in the MATLAB Web Browser.

codeCompatibilityReport(r)

Input Arguments

collapse all

Name of files or folders to analyze, specified as a character vector, cell array of character vectors, string scalar, or string array.

The name of a file must be a valid MATLAB code or App file (.m, .mlx, or .mlapp).

Example: '../thisFile.m'

Example: {'folderA','folderB','fileA'}

Data Types: char | string

Subfolder analysis indicator, specified as true, false, 0, or 1. By default, analyzeCodeCompatibility includes subfolders in the analysis. To omit subfolders, set tf to false or 0.

Code compatibility analysis results, specified as a CodeCompatibilityAnalysis object.

More About

collapse all

Code Compatibility Report

The code compatibility report contains information to help you upgrade your code to a new version of MATLAB. It contains these sections.

  • Syntax Errors — Table with details about syntax errors. For example, Using ~ to ignore a value is not permitted in this context. Syntax errors result in nonrunnable code and, while they are not introduced with a new version of MATLAB, syntax errors impact compatibility analysis.

  • Functionality that has been removed — Table with details about functionality that is being used in the analyzed code and that has been removed. For example, 'wavfinfo' has been removed. Use 'AUDIOINFO' instead.

  • Functionality that has changed behavior — Table with details about functionality that is being used in the analyzed code and that has changed behavior. For example, 'legend' has changed and might interpret the name of an argument as a legend property instead of a label. To include a label with the same name as a legend property, specify the labels using a cell array or string array. Refer to the documentation for a list of affected property names.

  • Unsupported functionality that might cause errors — Files listed here use functionality that is unsupported, undocumented, and not intended for customer use. Update your code to use documented functionality to avoid errors and unexpected behavior changes. For example, 'awtinvoke' is unsupported and might have been changed or removed without notice. With appropriate code changes, use javaMethodEDT instead.

  • Functionality that will be removed — Table with details about functionality that is being used in the analyzed code and that will be removed in a future release. For example, 'aviinfo' will be removed in a future release. Use 'VideoReader' instead.

  • Functionality that will change behavior — Table with details about functionality that is being used in the analyzed code and that will change behavior in a future release. For example, 'interp1(...,'cubic')' will change in a future release to perform cubic convolution. To continue using shape-preserving piecewise cubic interpolation, use 'interp1(...,'pchip')' instead.

  • New functionality that might improve code — Consider updating your code. Current code is expected to continue working in future releases but newer functionality is recommended. For example, Programmatic use of DISPLAY is not recommended. Use DISP or FPRINTF instead.

  • Full list of checks performed — Table with information about the checks performed on the specified code.

  • Full list of files analyzed — List of files that MATLAB analyzed for code compatibility.

Tips

Alternatives

Access the Code Compatibility Report from the Apps tab, under MATLAB, click the app icon: Code Compatibility Analyzer app icon.

Version History

Introduced in R2017b