Uninstalling old version of Matlab

I have three versions of Matlab on PC: R2017a, R2018b, and R2019b. I want to free up my laptop and delete these unused versions. I have a bunch of files that were created with R2017a. When I open these files they will open up R2017a instead of R2019B (even though I have R2019B on my PC). If I delete R2017a and R2018b from my PC, what will happen to these old files which default-open R2017a ? I ask because I still use those old files regularly for my academic research.

10 Comments

Mohammad Sami
Mohammad Sami on 1 Apr 2020
Edited: Mohammad Sami on 1 Apr 2020
As long as none of the functions are not deprecated in newer versions, they will still work.
To test,
Instead of opening files by double clicking, open the desired version of matlab,
navigate to the folder containing the files, and run it from command line.
So if I right-click on one of the .m files I wrote with R2017a, and select open with R2019b, a R2017a window will open the file up. However, if I open up R2019b, and then open the same file from R2019b, it will allow me to work on the file with R2019a. Is this a matlab file association problem?
More importantly, if I unistall R2017a and R2018b, will these files cooporate and properly open with R2019a by default (since it is the only version left)?
.m files will usually open with the release that was most recently registered as the file association. When you install MATLAB, it automatically registers that release. So if you were to install R2017a after R2019b, then files might suddenly start opening with R2019b.
The File Association Fix, when run from MATLAB, figures out which release you are using and registers that as the version to be used to open matlab related files.
The version that a file was created in does not come into play in any of this. MATLAB does not keep any version numbers associated with .m files. .m files are plain text files.
MATLAB does keep version numbers associated with .mlx (Live Script) and .mdl (old-style Simulink Models) and .slx (new-style Simulink models), but that does not affect which MATLAB version you get if you double-click the file. The double-click is the file association stuff I mentioned earlier, and goes along with the file extension (e.g., .slx), because File Explorer does not know anything about version numbers. When you open a .mlx or .mdl or .slx in a newer MATLAB release than it was created with, then MATLAB automatically figures out backwards compatibility issues. If you try to open a .mdl or .slx with an older MATLAB release than it was created with, MATLAB refuses. If you try to open a .mlx (Live Script) with an older release than it was created with, then if I understand what people have been posting, MATLAB will try to open it, but it will not always succeed.
Okay, so if I uninstall all but one version, then all my matlab files will be associated with the only available matlab version?
No, you will probably need to run File Association Fix.
Ok. I looked at the documentation you provided. What I inputs do you suggest I use?
Will running “delete add” in my choice version of matlab do the trick?
Sounds plausible.
I took a closer look at the documentation and ran the code. It worked wonderfully! Thank you for this code and your help.

Sign in to comment.

Answers (1)

M-files will work in the newer version provided functions are not deprecated in newer version.
As mentioned in the comment, you can test the files by opening the files using the desired version of MATLAB.
In order to use Simulink files, you will need to be mindful of which version you are using. You can always open an older file in a newer release (i.e. R2019b will open a R2017a Simulink model), but not the other way around (i.e. R2019b will not open a R2017a Simulink model). To be backwards compatible, you will need to make sure you "export" any work done in R2019b to R2017a by going to File >> Export As >> Previous Version.
You can also have a look at the answer by Vikaasa Kumar about the codeCompatibilityReport:
Documentation for codeCompatibilityReport:

Categories

Tags

Asked:

on 31 Mar 2020

Commented:

on 12 Apr 2020

Community Treasure Hunt

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

Start Hunting!