Running/testing scripts on multiple Matlab/Simulink versions?

1 view (last 30 days)
I do a lot of script and tool development for Matlab/Simulink. This involves supporting multiple versions of Matlab, usually from R2016a+ (previously it was R2011b+). This means that I have almost a dozen different versions of Matlab installed on my computer. When one of my tools/scripts encounters a bug in a version of Matlab, or the Matlab/Simulink behaviour differs between versions, I need to be able to pinpoint which version the bug occurred in or the behaviour changed in. I usually can't find the bugs listed on the Bug Reports support page, especially when the bugs are already fixed in later versions. Likewise, when the behaviour changes I check if it is noted in the Release Notes, but these are very high-level descriptions and I usually can't find it mentioned.
Given that the aforementioned pages are not reliable, I usually need to figure out which version of Matlab has the bug fix or behaviour change. I typically follow this process:
  • I create a script to replicate the bug automatically (if possible).
  • One by one I open each version of Matlab, execute the script, and make note of when the bug occurs. Sometimes I have to download and install additional Matlab versions.
  • Then I develop a workaround for the bug or behaviour change by having the script check which version it is running on, and then perform extra steps to fix the buggy behavior or accommodate for inconsistent behaviours between the versions.
My questions is: Is it possible run a script on multiple versions of Matlab in order to make this process a little easier?

Accepted Answer

Peter O
Peter O on 11 Mar 2020
MATLAB can run in a headless mode from the command line, where it can take a script to execute. It's been a while since I've done it, but I believe you start it with a -nojvm and a -nodisplay flag, and there might be a few other things. This post outlines a lot of it:
https://www.mathworks.com/matlabcentral/answers/409523-running-matlab-using-command-line
I'd imagine you can draw from a list of the binary locations for each release. From my experience, Simulink should also work this way, being called from headless (which is basically what the parallel toolbox workers do).
If you want to get really crazy, you can even use the "!" character to make system cmdline calls from within a supervisory MATLAB script, and catch everything in a try/catch or pipe problems over to stderr. Who needs a pesky script in bash or powershell!

More Answers (0)

Categories

Find more on Install Products in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!