matlabmatlab-figurematlab-guidematlab-compiler

What are the steps to upgrade old MATLAB code files?


I'm currently using MatLab 6.5 (it's a 2004 version), because the custom code files I need aren't compatible with newer versions.

I'm wondering what are the necessary steps to update those files.

Thanks very much to everyone reading!


Solution

  • Ideally, those files have associated unit tests, so you could have an indication on whether each of them runs correctly or not. Probably not your case.

    If you can, try having both Matlab versions on your machine, then have a copy of the file sets to modify and another copy just to inspect and run in the old version for reference.

    If changes are expected to be made on a per file basis, then start by opening each file and checking warnings. As good practice, never leave warning in .m files, and suppress those that you'll be accepting nominally. I.e. put %#ok<NASGU> or other warning code but not simply %#ok. Most upgrade related issues are indicated by warnings. You can check the current folder for such problems with mlintrpt (see here)

    Then, there is a compatibility tool codeCompatibilityReport, simply typing this will explore folders in your current workspace, and you might just use that if you expect changes in general to be minor or not to be needed for every file.

    Now, for simple files, these should be everything you need, I"d expect that after some debugging and relearning, you'd have a much smoother experience with a recent version of Matlab than with a 10+ years old version. For shorter-term updates, I would recommend to avoid switching versions mid-project.