Check code compatibility with older releases

57 views (last 30 days)
Hi, I am wondering if there is a more or less efficient way to check backwards compatibility. Here is an example: I am using this code in R2023a:
roi = images.roi.Rectangle;
roi.EdgeAlpha=0.75;
roi.FaceAlpha=0.05;
roi.LabelVisible = 'on';
roi.Tag = 'RegionOfInterest';
But a user reports problems with R2019b, ROI.EdgeAlpha doesn't exist yet in this release. I searched MATLAB help to find any info in which release this property was added, but I can't find any information. This has happened relatively often, and I wonder what I am doing wrong. How can I find information about properties that are missing in older releases? Thanks!

Accepted Answer

John D'Errico
John D'Errico on 11 Feb 2024
Edited: John D'Errico on 11 Feb 2024
A way to automatically check code compatibility with older releases, and see at what point a feature that you use makes your code not backwards compatible? No. Sorry.
You would need to have those older releases installed on your computer. That is possible to some extent, as long as they themselves will launch on your computer.
Even then, you would need to have test suites for your code that will test all possible paths through your code, to insure that every possible feature in your code is fully verified. Few authors do that as it is anyway. I often try, but I'll admit that my own set of tests surely miss some things. True perfection is difficult to achieve.
Even that fails however. For example, older releases of MATLAB will not run at all on newer computers. This is due to many things, generally not anything under the control of The MathWorks. So you might have some feature in your code that is viable in an older release, but you will not be able to test that older release, because something else prohibits your computer from running that release at all. And that would force you to maintain multiple older computers at your site, just to test code compatibility. And then you need to deal with issues of different manufacturers, completely different operating systems. Mac versus Windows, etc.
Sorry. If you want to know if something will fail, you will need to read the release notes diligently. Simpler yet, just wait for reports to filter in, that something failed. But there is no direct, magical, automatic way to do what you wish to see.

More Answers (1)

Karl
Karl on 11 Feb 2024
Edited: Karl on 11 Feb 2024
  1 Comment
William Thielicke
William Thielicke on 11 Feb 2024
I tried this with R2019b. It doesn't detect another incompatibility:
Unrecognized property 'LabelAlpha' for class 'images.roi.Polyline'.
Error in PIVlab_GUI>extract_draw_extraction_coordinates_Callback (line 4460)
extract_poly.LabelAlpha = 0.5;
So it is actually completely useless.

Sign in to comment.

Categories

Find more on Programming in Help Center and File Exchange

Products


Release

R2023a

Community Treasure Hunt

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

Start Hunting!