MATLAB Answers

Tool to check script compatiblity with Matlab versions?

39 views (last 30 days)
Andreas on 19 Jul 2012
Commented: Yudhsihthir Raut on 11 Oct 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,

Answers (3)

Vikaasa Kumar
Vikaasa Kumar on 27 Oct 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.
Dr. GFreak
Dr. GFreak on 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?

Sign in to comment.

Jan on 19 Jul 2012
Yudhsihthir Raut
Yudhsihthir Raut on 11 Oct 2019
can we print or save this report codeCompatibilityReport

Sign in to comment.

Andreas Goser
Andreas Goser on 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.
Jan on 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.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!