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.

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

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.

    The table includes this information.

    Report ColumnDescription
    OccurrencesTotal number of syntax errors in file.
    FilenameName of file that contains syntax errors.

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

    The table includes this information.

    Report ColumnDescription

    Description

    Description of check. Description is same as code analyzer message.

    Documentation

    Link to more information in documentation.

    Removed InThe release in which the functionality was removed.
    FilenameName of file that contains flagged check.
    LineLine number indicating location in file of flagged check.

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

    The table includes this information.

    Report ColumnDescription

    Description

    Description of check. Description is same as code analyzer message.

    Documentation

    Link to more information in documentation.

    Affects Code Written BeforeThe release in which the functionality was changed.
    FilenameName of file that contains flagged check.
    LineLine number indicating location in file of flagged check.

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

    The table includes this information.

    Report ColumnDescription

    Description

    Description of check. Description is same as code analyzer message.

    Documentation

    Link to more information in documentation.

    FilenameName of file that contains flagged check.
    LineLine number indicating location in file of flagged check.

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

    The table includes this information.

    Report ColumnDescription

    Description

    Description of check. Description is same as code analyzer message.

    Documentation

    Link to more information in documentation.

    FilenameName of file that contains flagged check.
    LineLine number indicating location in file of flagged check.

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

    The table includes the same columns as the Functionality that will be removed section.

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

    The table includes this information.

    Report ColumnDescription

    Description

    Description of check. Description is same as code analyzer message.

    Documentation

    Link to more information in documentation.

    FilenameName of file that contains flagged check.
    LineLine number indicating location in file of flagged check.
    SuppressionWhether and how this check is suppressed in the Editor. A value of None indicates that the check is not suppressed.

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

    Report ColumnDescription

    Occurrences

    In analyzed code, total number of occurrences where a particular check is flagged.

    Files

    In the analyzed code, number of files where a particular check is flagged.

    Description

    Description of check. For example, Use a newline, semicolon, or comma before this statement or STRMATCH is not recommended. Use STRNCMP or VALIDATESTRING instead. Description is same as code analyzer message.

    Severity

    Severity of check. For example, Error or Warning. Errors might indicate syntax errors or use of functionality that is no longer supported. Warnings might indicate opportunities to improve your code.

    Identifier

    Identifier for MATLAB code analyzer messages.

    Documentation

    Link to more information in documentation.

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

Tips

Alternatives

Generate a Code Compatibility Report for code in the current working folder and subfolders in the Current Folder browser. In the Current Folder browser, either click or right-click the white space. Then select Reports > Code Compatibility Report. See MATLAB Code Compatibility Analyzer.

Version History

Introduced in R2017b