主要内容

MATLAB代码兼容性报告

代码兼容性报告是一个方便的工具,可分析您的代码,列出表格格式的整个兼容性问题,并为您提供有关如何解决这些兼容性问题的说明。该报告使您能够:

  • 确定您必须解决代码必须在当前MATLAB中正确运行的兼容性问题®释放。

  • 估算升级到较新的MATLAB版本时更新代码所需的精力。

  • Improve your code by replacing functionality that is not recommended.

代码兼容性报告显示您的代码中的位置,这些位置受兼容性问题的影响,并提供了文档的链接,以获取有关如何在每个位置进行必要更改的更多信息。

生成代码兼容性报告

运行代码兼容性报告:

  1. 在当前文件夹浏览器中,导航到并打开包含要分析的代码文件的文件夹。

  2. 在当前列出要分析文件的文件夹浏览器中,要么单击或在浏览器的空白处右键单击。这两个选项打开菜单。选择Reports>代码兼容性报告。Alternatively, you can runCodeCompatibilityReport在命令提示下生成报告。

    The report displays in the MATLAB Web Browser, showing potential compatibility issues. For example:

  3. 更新您的代码以解决在此中列出的每个文件的语法错误语法错误部分。语法错误导致无法运行的代码。尽管最有可能在以前的版本中无法正确运行该代码,但语法错误会影响兼容性分析。例如,'}'的解析错误:用法可能无效MATLAB语法

  4. 报告中所列的每一个功能的,里维w 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文档与消息关联的链接。

    Each functionality listed in the report displays a recommended action. You also can use the following general advice:

    • Functionality that has been removed- 更新您的代码,以避免当前版本中的兼容性错误。

    • 改变行为的功能— Confirm that the change in behavior is acceptable, and if not, update your code for the current release.

    • 可能万博1manbetx导致错误的无支撑功能— 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.

    • 将删除的功能- 立即或以后版本更新您的代码。现在更新代码使以后的升级更加容易。

    • 会改变行为的功能- 现在调查这些更改,以使将来的升级更加容易。

    • 可能改善代码的新功能- 考虑更新您的代码。当前的代码预计将继续在将来的发行版中工作,但建议使用较新的功能。

    代码兼容性报告还包括有关您在代码上执行的检查以及MATLAB分析代码兼容性的文件列表的信息。

程序化使用

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 theCodeCompatibilityReport功能。

  • 返回CodeCompatibilityAnalysis包含报告信息的对象,使用分析兼容性功能。You can then display a report for the stored object using theCodeCompatibilityReport功能。

不支万博1manbetx持的功能

The Code Compatibility Report checks for functionality that is unsupported, undocumented, and not intended for use. Such features are subject to change or removal without notice and can cause future errors. In some cases there is documented replacement functionality, but there might be no simple replacement. ContactMathworks支万博1manbetx持描述您的使用情况并请求支持的替换。万博1manbetx

也可以看看

||