Tool to check script compatiblity with Matlab versions?

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

Risposte (3)

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 Commenti

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.

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?

Accedi per commentare.

Jan
Jan il 19 Lug 2012
No.

3 Commenti

Jan
Jan il 19 Lug 2012
Modificato: Jan il 19 Lug 2012
Sorry for this lean answer. But you simply asked a very good question. Yes/no questions are rare in this forum, such that I couldn't resist to answer as efficient as possible.
Such a tool would be extremely helpful, because debugging on a customer's computer remotely is prone to errors and inconvenient. The best solution is to create exhaustive unit- and integration-test functions, which check the compatibility of all single (sub)-functions separately at first, and then the main functions considering the dependencies and the user-interaction. The creation of such a test-suite takes usually as long as the creation of the actual program. But finally you have an exahaustive test, which is required for any quality control.
I knew Jan couldn't resist :-)
can we print or save this report codeCompatibilityReport

Accedi per commentare.

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 Commenti

By the way, as I see you are an academic user. If you have paying cutomers, you probaly have a commercial license. If you just have internal users you treat as customers (which is a great attitude!), and have an academic license, then the academic license is still a professional license.
To my best knowledge only Student Versions are not professional licenses.
Thanks for your answers. I have a academical license which I use during my studies. Fortunately due to that experience I'm also in a company that develops algorithms in Matlab! In academia reusing a script written 10years ago is quiet rare as I would guess but my company has lots of old Matlab code that I'd like to port to the current release of Matlab!
Please feel free to contact MathWorks Technical Support in Germany for any help and guidance.
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.

Accedi per commentare.

Categorie

Prodotti

Richiesto:

il 19 Lug 2012

Commentato:

il 11 Ott 2019

Community Treasure Hunt

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

Start Hunting!

Translated by