Tool to check script compatiblity with Matlab versions?

10 次查看(过去 30 天)
I have several Matlab scripts (m files) and our customers have different Matlab versions. Is there a tool to check for compatibility of each script with certain Matlab versions?
Thanks in advance for your help,
Andreas

回答(3 个)

Vikaasa Kumar
Vikaasa Kumar 2017-10-27
For MATLAB R2017b and newer ONLY:
Yes, we do have a tool to create a codeCompatibilityReport for the current working folder and subfolders. This feature was introduced in MATLAB R2017b. 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.
Navigate to the directory hosting your M files that you wish to run the code compatibility report for, within MATLAB. Then, execute the following command:
>> codeCompatibilityReport
The code compatibility report contains information to help you upgrade your code to a new version of MATLAB. It contains these sections.
  • Incompatibility and Syntax Errors — Table with details about syntax errors and incompatibility considerations in the analyzed code. For example, "Using ~ to ignore a value is not permitted in this context or 'wavfinfo' has been removed. Use 'AUDIOINFO' instead."
  • Warnings and Other Recommendations — Table with details about warnings and other opportunities to improve your code. For example, "Programmatic use of DISPLAY is not recommended. Use DISP or FPRINTF instead."
  • Checks Performed — Details the checks performed on the specified code.
  • Files — List of files that MATLAB analyzed for code compatibility.
  2 个评论
Jan
Jan 2017-10-28
This sounds very useful. Thanks for mentioning it. +1
Does this consider undocumented changes like fopen('VAX-D') or strncmp('a', 'a', 2) (see https://www.mathworks.com/matlabcentral/answers/17089-changes-in-strncmp)?
Such a tool can find problems with the backward compatibility only, most likely. It would be wonderful, if it uses an online database, to mention problems with later versions also.
Dr. GFreak
Dr. GFreak 2018-4-23

Just to be clear: this function only checks compatibility going forward, right? E.G. it does not check compatibility with, say, 2014b. But were I to run this check in 2018a, it would find compatibility issues with 2017b, if they exist?

请先登录,再进行评论。


Jan
Jan 2012-7-19
No.
  3 个评论

请先登录,再进行评论。


Andreas Goser
Andreas Goser 2012-7-19
I am not aware of such a tool. Such a tool however would just be able to check the intended incompatibilities and not bugs, right? So I do not see an alternative to testing.
One thing you may be not aware of is that if you have a professional license, you can install multiple releases in parallel on your machine, so that you can verify MATLAB code yourself.
There are good practices how to create MATLAB code that increases the odds that the code is release independent. On the other hand, this often means to know what relatively new features are - and avoid them for a while.
Last not least, for MATLAB code, there is a high chance that upgrading is a smooth expericence for your customers. And also they can install more releases in parallel. And Technical Support can greatly assist with issues on upgrading.
  4 个评论
Andreas Goser
Andreas Goser 2012-7-19
Please feel free to contact MathWorks Technical Support in Germany for any help and guidance.
Jan
Jan 2012-7-19
Installing several Matlab releases involves, that the user can afford several Matlab releases. For the original question, this requires even all toolboxes owned by the customer, because their function-names could collide with user-defined functions. At least for the later problem TMW has enough data -full installations of all releases- to create such a test-function in several hours.
While I have such a tool written by myself (based on FEX: UniqueFuncNames), I cannot feed it sufficiently due to the large number of releases and toolboxes I do not have. On the other hand such an important tool should be maintained by TMW only.
Even with a currently owned professional license, installing 6.5, 7.0, 7.1, 2008a, 2008b32&64, 2009a/32&64, 2011a/32&64 (these are used by labs we are sharing software with) is no efficient solution.
And as we found out in several former discussion: It is impossible to find all incompatibilities programmatically, such that an exhaustive manuall control is obligatory in every case.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by