Main Content

Code Compatibility Analyzer

Identify and address compatibility issues against current version of MATLAB

Description

The Code Compatibility Analyzer app generates a report of syntax errors, code incompatibilities. and new functionalities that might improve the code in a selected folder and its subfolders.

Using this app, you can:

  • Identify compatibility issues.

  • Follow suggested actions to improve code.

Open the Code Compatibility Analyzer App

  • MATLAB® Toolstrip: On the Apps tab, under MATLAB, click the app icon: Code Compatibility Analyzer app icon.

  • MATLAB command prompt: Enter codeCompatibilityAnalyzer

Examples

expand all

Open the Code Compatibility Analyzer.

codeCompatibilityAnalyzer

This command opens a prompt to select a folder. Select the folder to analyze.

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

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

    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 used in the analyzed code that has been removed. For example, 'wavfinfo' has been removed. Use 'audioinfo' instead.

    Report ColumnDescription

    Description

    Description of check with suggested action

    Documentation

    Link to more information in documentation

    Removed InRelease 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 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.

    Report ColumnDescription

    Description

    Description of check with suggested action

    Documentation

    Link to more information in documentation

    Affects Code Written BeforeRelease 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 — 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.

    The table includes this information.

    Report ColumnDescription

    Description

    Description of check with suggested action

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

    Report ColumnDescription

    Description

    Description of check with suggested action

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

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

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

    Report ColumnDescription

    Description

    Description of check with suggested action

    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 details about the checks performed on the specified code.

    Report ColumnDescription

    Occurrences

    In analyzed code, total number of occurrences of flagged checks

    Files

    In analyzed code, number of files

    Description

    Description of check with suggested action. For example, Use a newline, semicolon, or comma before this statement or STRMATCH is not recommended. Use STRNCMP or VALIDATESTRING instead.

    Severity

    Severity of check. For example, Error or Warning. Errors can indicate syntax errors or use of functionality that is no longer supported. Warnings can 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 the app analyzed for code compatibility.

Related Examples

Version History

Introduced in R2022a