Main Content

Code Compatibility Analyzer

Identify and address compatibility issues against current version ofMATLAB

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 theAppstab, underMATLAB, click the app icon:Code Compatibility Analyzer app icon.

  • MATLAB command prompt: EntercodeCompatibilityAnalyzer

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

兼容的代码分析器生成备用ion 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 Column Description
    Occurrences Total number of syntax errors in file
    Filename Name of file that contains syntax errors

  • Functionality that has been removed用于t -表细节功能he analyzed code that has been removed. For example,'wavfinfo' has been removed. Use 'audioinfo' instead.

    Report Column Description

    Description

    Description of check with suggested action

    Documentation

    Link to more information in documentation

    Removed In Release in which the functionality was removed
    Filename Name of file that contains flagged check
    Line Line number indicating location in file of flagged check.

  • Functionality that has changed behavior用于t -表细节功能he 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 Column Description

    Description

    Description of check with suggested action

    Documentation

    Link to more information in documentation

    Affects Code Written Before Release in which the functionality was changed
    Filename Name of file that contains flagged check
    Line Line 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 Column Description

    Description

    Description of check with suggested action

    Documentation

    Link to more information in documentation

    Filename Name of file that contains flagged check
    Line Line number indicating location in file of flagged check

  • Functionality that will be removed用于t -表细节功能he analyzed code that will be removed in a future release. For example,'aviinfo' will be removed in a future release. Use 'VideoReader' instead.

    Report Column Description

    Description

    Description of check with suggested action

    Documentation

    Link to more information in documentation

    Filename Name of file that contains flagged check
    Line Line 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 theFunctionality that will be removedsection.

  • 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 Column Description

    Description

    Description of check with suggested action

    Documentation

    Link to more information in documentation

    Filename Name of file that contains flagged check
    Line Line number indicating location in file of flagged check
    Suppression Whether and how this check is suppressed in the Editor. A value ofNoneindicates that the check is not suppressed

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

    Report Column Description

    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 statementorSTRMATCH is not recommended. Use STRNCMP or VALIDATESTRING instead.

    Severity

    Severity of check. For example,ErrororWarning. 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