MATLAB: Is there a tool to make a program compatible with an older version of MATLAB? Backwardsc​ompatibili​ze…

MATLABversion compatibility

The situation is this: I've written and maintained a toolbox for image data analysis over a ~10 year period. During this time matlab has gone through a number of versions, and I've made the modifications to keep my program running in "my current MATLAB". Initially there were not (m)any other users, but now there is a slowly growing number of users. Then there is problems when they are using older versions of MATLAB, sometimes even releases that I for one reason or the other skipped. Now with 20-20 hindsight, I realize that I should've kept the tools backwards compatible as I went ahead, but that was often not done…
Now to the question: Is there anyone that has "solved" this problem, that is developed practices, routines, or even tools to make the backwardcompatibilization? Is there any advice or tips to ease this, or will I be forced into a messy-n-massive coding slog?

Best Answer

I'm programming for Matlab 6.5 and 2009a. I avoid the new features for backward compatibility: No Java, UITABLE, TREEVIEW, ACCUMARRAY, BSXFUN, REGEXP('split'), OO, ... But there are a lot of futher unexpected incompatibilities: PLOT replies line handles in Matab 6.5, but lineseries handles in 2009a. DATENUM('7:30') uses the current date in 2009a, but 00-Jan-0000 in 6.5. This list could be continued until tomorrow. Therefore I'm sure, that an automatic tool might find some obvious incompatibilites, but this will never be exhaustive or even reliable.
I've created some backported function to support new standard functions: ANCESTOR, an efficient ISFIELD, TYPECAST, BSXFUN, COMMANDWINDOW, ... Some of these functions can be found in the FEX - others seem to have the same needs...
Unit-testing would be a good idea: Install your program on a specific Matlab version and test it exhaustively. If no error occurs, there is a good chance, that your program is compatible with the specific Matlab version.