Is it possible to uninstall previous version of a custom toolbox as part of toolbox installation?

2 views (last 30 days)
I have created a custom MATLAB toolbox. As part of the installation process, is it possible to uninstall the previous version (if installed)? I was looking for a seamless installation so that users don't have to explicitly remember to uninstall the previous version.

Answers (1)

Jan
Jan on 3 Aug 2017
It depends. If the toolbox is stored in a specific folder, you can delete this folder. But perhaps the users modify the M-files and deleting the folder might not be wanted.
A strategy would be to store the folder location in Matlab's preferences (see setpref). Include a checksum in each file. When a new version is installed, use getpref to obtain the former folder, check if any file was modified and if not ask the user if the former version should be deleted.
I keep older versions of toolboxes for a comparison of the results. This is useful to control, if the new version has bugs or changed output.
  2 Comments
Sunny Talekar
Sunny Talekar on 3 Aug 2017
Hi Jan, Your answer conceptually sounds good. I'm afraid I don't quite understand how to implement it - as in at what point should I be manipulating the preferences.
The toolbox gets installed in the toolboxes directory under 'userpath'. Ideally, I'd like to make the process transparent to the end user - uninstall the previous one every time you install the new one. The only way I could think of is installing using m-script (instead of .mltbx) which checks for previously installed versions, removes it and then installs the new one. Doesn't sound elegant though.
Jan
Jan on 3 Aug 2017
uninstall the previous one every time you install the new one
I would hate this as a customer.
I assume the uninstallation can be solved in many ways transparently. Simply start to implement it and solve the problems step by step. It is hard to suggest an exact way without providing the full program.

Sign in to comment.

Categories

Find more on Introduction to Installation and Licensing in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

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

Start Hunting!