Is there a tool to make a program compatible with an older version of MATLAB? Backwardscompatibilize...
Mostrar comentarios más antiguos
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?
Respuesta aceptada
Más respuestas (2)
Patrick Kalita
el 8 de Feb. de 2011
This answer is about the mechanics of how to check the MATLAB version from your code. Maybe your question was more broad than that, but in case you weren't aware of them there are a few functions which you might find useful. I think the best option is the verLessThan function. From its help section:
if verLessThan('matlab', '7.0.1')
% Put code to run under MATLAB older than MATLAB 7.0.1 here
else
% Put code to run under MATLAB 7.0.1 and newer here
end
The verLessThan function itself was introduced in MATLAB R2007a. Anyone using a version older than that can download a copy of it from this solution.
You can also use the ver command and do your own string comparisons with the values in the structure it returns:
>> V = ver('MATLAB')
V =
Name: 'MATLAB'
Version: '7.11'
Release: '(R2010b)'
Date: '03-Aug-2010'
>>
That will involve a little more work on your part, but it does give you a little more flexibility (you could do a switch-case statment to discriminate between many versions) and this syntax will work going back to at least MATLAB R13sp2.
2 comentarios
Bjorn Gustavsson
el 8 de Feb. de 2011
Yes, I'm aware of those, but my question was indeed broader than that, kind of "any tricks to change the stuff that have to go in after verLessThan". Thanks for this starter...
Jan
el 9 de Feb. de 2011
The linked verLessThan function fails to distinguish Matlab v7.10 and v7.1. You can use isMatlabVer: http://www.mathworks.com/matlabcentral/fileexchange/27231 . It is very funny, that just this tool to check versions suffers from version numbers, which are defined by MathWorks.
Erik Newton
el 9 de Mzo. de 2024
1 voto
It's early days, but I've just started this project: https://github.com/enewton/matlab-backports
It's an attempt to implement some of the simple helper functions which appear in each new release, to help you run newer code with an older MATLAB version.
2 comentarios
DGM
el 10 de Mzo. de 2024
Nice. I've reimplemented a few things in MIMT (e.g. the various changes to colormap generators), but at least the version-compatibility things I don't bother implementing in an identical manner.
It'd be nice to see a clim()/caxis() alias.
Erik Newton
el 10 de Mzo. de 2024
Thanks for the positive comment and suggestion. I've added clim.
Categorías
Más información sobre Data Type Conversion en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!