Tool to check script compatiblity with Matlab versions?

조회 수: 6 (최근 30일)
Andreas
Andreas 2012년 7월 19일
댓글: Yudhsihthir Raut 2019년 10월 11일
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 knew Jan couldn't resist :-)
Yudhsihthir Raut
Yudhsihthir Raut 2019년 10월 11일
can we print or save this report codeCompatibilityReport

댓글을 달려면 로그인하십시오.


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