Compatibility of code when updating Matlab licence

1 Ansicht (letzte 30 Tage)
Morgane PICOT
Morgane PICOT am 24 Jun. 2022
Kommentiert: Steven Lord am 24 Jun. 2022
Hello everyone,
I am working on a project requiring to use at least Matlab R2016, however all the code I wrote before is designed for Matlab R2014b... As I have not found a tool to check incompatibilities - the one available on Matlab platfrom starts with R2017 version-, I was wondering if someone could help me make sur that updating my licence won't make me start over all the work I've already done.
Thanks for the help!
Morgane
PS: as the computer uses Windows7, would you know what is the latest version I can actually use?

Antworten (1)

Jan
Jan am 24 Jun. 2022
R2021b supports Windows 7 SP1, while Win7 is not supported in R2022a anymore.
There is no tool for an exhaustive check of incompatibilities. The greates difference is the new Graphics System "HG2", but this was part of R2014b already. So actually you can expect your code to be running.
The only trustworthy method is to check this exhaustively by UnitTesting. This requires a complete set of valid and invalid inputs for all functions you use. If you did not include such tests from the beginning, adding them afterwards is very time-consuming.
I'm using a large project with about 300'000 lines of Matlab code and 65'000 lines for the unit-testing. These tests revealed many incompatibilities between the Matlab versions, e.g. strncmp with empty arguments or n=0. It took many hours to check each occurrence of strncmp, if it depends on such input.
  2 Kommentare
Morgane PICOT
Morgane PICOT am 24 Jun. 2022
Thank you very much for the answer! I also have a quite large project and was expecting the process to be too time-consuming, hence my hope to have a tool to check incompatibilities... I will definitely try UnitTestings, it may be safer than than just update Matlab and see: should I install Matlab unit testing framework? Which of the three units tests (script-based, function-based, class-based) would be more relevant in your opinion? (My code is in one file with functions defined one after the other).
Otherwise, it is good to know that even R2021 version of Matlab is compatible with Windows 7.
Steven Lord
Steven Lord am 24 Jun. 2022
You don't need to install the unit testing framework. It's part of MATLAB.
The matlab.unittest.TestCase class has been part of MATLAB since release R2013a if you want to create class-based tests. But if you're not familiar with classes you can still create function-based tests (functiontests was introduced in release R2013b) or script-based tests (assert was introduced in release R2007a, runtests in release R2013b.)
This documentation page describes the functionality provided by each type of tests. Function- and class-based tests can do everything script-based tests can do and more, and class-based tests provide additional functionality beyond what's available in function-based tests. Which type of tests you write depends on your level of comfort with writing scripts, functions, or classes in MATLAB and what functionality you need to efficiently test your code.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Write Unit Tests finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by