Tool to check script compatiblity with Matlab versions?

3 Ansichten (letzte 30 Tage)
Andreas
Andreas am 19 Jul. 2012
Kommentiert: Yudhsihthir Raut am 11 Okt. 2019
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

Antworten (3)

Vikaasa Kumar
Vikaasa Kumar am 27 Okt. 2017
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 Kommentare
Jan
Jan am 28 Okt. 2017
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 am 23 Apr. 2018

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?

Melden Sie sich an, um zu kommentieren.


Jan
Jan am 19 Jul. 2012
No.
  3 Kommentare
Andreas Goser
Andreas Goser am 19 Jul. 2012
I knew Jan couldn't resist :-)
Yudhsihthir Raut
Yudhsihthir Raut am 11 Okt. 2019
can we print or save this report codeCompatibilityReport

Melden Sie sich an, um zu kommentieren.


Andreas Goser
Andreas Goser am 19 Jul. 2012
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 Kommentare
Andreas Goser
Andreas Goser am 19 Jul. 2012
Please feel free to contact MathWorks Technical Support in Germany for any help and guidance.
Jan
Jan am 19 Jul. 2012
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.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Introduction to Installation and Licensing finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by