MATLAB Answers

Set Add-ons path using commands

54 views (last 30 days)
aL on 29 Sep 2017
Edited: John Harris on 12 Sep 2018
I'm interested in setting the Add-ons path using commands rather than going through the MATLAB preferences dialog. Is there a way to do this?


Sign in to comment.

Answers (1)

Henry Giddens
Henry Giddens on 30 Sep 2017


Show 2 older comments
aL on 30 Oct 2017
Hi Henry,
Thanks for trying. Unfortunately Add-On preferences are not stored in that file. I actually have no idea where they are stored.
However, I did find a (rather unstable) solution. After hunting around in MATLAB functions for setting different preferences, I found a Settings/settings command (depending on which version of MATLAB). It returns a handle to MATLAB settings, though most of the properties are hidden. After some trial and error, I figured out how to change the Add-on path. However, I've also discovered that the ability to apply my solution is limited to the version of MATLAB. This is what I came up with for the different versions of MATLAB I have access to:
s = Settings;
try % R2016
catch % R2015
catch % R2017
s = settings;
s.matlab.addons.InstallationFolder.PersonalValue = addonpath;
John Harris
John Harris on 27 Dec 2017
Thanks for that, aL! I was only needing to get the current value but running into the same problem. You saved me a lot of time!
For the S/s issue with settings, could you try out this command?
To clarify, for 2017b:
rootSettings = matlab.internal.getSettingsRoot
folder = rootSettings.matlab.addons.InstallationFolder.ActiveValue
returns these
rootSettings =
SettingsGroup with properties:
connector: [1×1 SettingsGroup]
Simulink: [1×1 SettingsGroup]
installedAddons: [1×1 SettingsGroup]
slhistory: [1×1 SettingsGroup]
folder =
I don't have better solution for the change from 'AppsInstallFolder' to 'InstallationFolder' that you detected at R2016; the try/catch works well for that.
John Harris
John Harris on 4 Jan 2018
One place the add-ons directory is stored, at least on Windows, is a matlab.settings file in the AppData folder. For example, mine is c:\users\username\AppData\Roaming\MathWorks\MATLAB\R2017b\matlab.settings with a key name of "InstallationFolder".

Sign in to comment.

Sign in to answer this question.


Translated by