Durin
Durin

Reputation: 687

Tool to check compatiblity with Matlab versions?

I have several scripts (m Files) and our customers have different Matlab versions. Is there a tool to check for compatiblity of each script with certain Matlab versions?

Upvotes: 9

Views: 2016

Answers (3)

Vikaasa Ramdas
Vikaasa Ramdas

Reputation: 471

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.

Here is a link to the MATLAB Answers Post with more information: https://www.mathworks.com/matlabcentral/answers/364764-is-there-a-tool-to-check-for-compatibility-between-different-matlab-versions

Upvotes: 3

High Performance Mark
High Performance Mark

Reputation: 78354

You might be able to do what you want with the checkcode function. Alternatively, you can use functions such as version and verLessThan to write your scripts and functions such that they check which version they are being run on and take appropriate action.

Upvotes: 4

BigA
BigA

Reputation: 87

Depending on the version of Matlab that you are migrating to, there is a feature called the Upgrade Advisor which can check this sort of thing (it's very similar to the Simulink Model Advisor).

Upvotes: 0

Related Questions