Main Content

matlab.addons.install

Install add-on

Description

example

newAddon = matlab.addons.install(fileName) installs the add-on specified by fileName. If a version of the add-on is already installed, MATLAB® overwrites the previous version.

MATLAB installs the add-on in the default add-on installation folder. For more information including how to change the default add-on installation folder, see Get and Manage Add-Ons.

matlab.addons.install only supports installing toolboxes.

example

newAddon = matlab.addons.install(fileName,agreeToLicense) accepts the license agreement before installing the add-on if agreeToLicense is true.

example

newAddon = matlab.addons.install(fileName,installOption) installs the add-on without overwriting previously installed versions if installOption is 'add'. Otherwise, if a version of the add-on is already installed, MATLAB overwrites the previous version.

newAddon = matlab.addons.install(fileName,agreeToLicense,installOption) installs the add-on using the specified license and install options.

Examples

collapse all

Assume that you have the My toolbox.mltbx toolbox file in your C:\Downloads\ folder, and that the toolbox contains a license agreement. Install the toolbox and prevent MATLAB from opening the license agreement dialog box by indicating you accept the license.

toolboxFile = 'C:\Downloads\My toolbox.mltbx';
agreeToLicense = true;
matlab.addons.install(toolboxFile,agreeToLicense)

Verify that the toolbox is installed.

addons = matlab.addons.installedAddons
 addons =

  1×4 table

             Name                   Version     Enabled                  Identifier              
    ___________________________    _________    _______    ______________________________________

    "My Toolbox"                   "2.0"         true      "6de8682e-9c3c-407e-bad7-aa103d738d08"

Suppose that you have version 2.0 of a toolbox called My Toolbox installed on your system. Install version 4.0 of the toolbox without overwriting version 2.0.

Assume that you have the 'My toolbox_v4.0.mltbx' toolbox file in your current working folder. Install the toolbox without overwriting the existing installed version by specifying that you want to add the toolbox.

toolboxFile = 'My toolbox_v4.0.mltbx';
installOption = 'add';
matlab.addons.install(toolboxFile, installOption)
ans =

  1×4 table

          Name           Version    Enabled                  Identifier              
    _________________    _______    _______    ______________________________________

    "My toolbox_v4.0"     "4.0"      true      "6de8682e-9c3c-407e-bad7-aa103d738d08"

If the toolbox contains a license agreement, a dialog box opens to prompt you to agree to the license before installation.

Verify that the previous version of the toolbox is still installed.

addons = matlab.addons.installedAddons
addons =

  2×4 table

             Name                   Version     Enabled                  Identifier              
    ___________________________    _________    _______    ______________________________________

    "My Toolbox_v4.0"              "4.0"         true      "6de8682e-9c3c-407e-bad7-aa103d738d08"
    "My Toolbox"                   "2.0"         false     "6de8682e-9c3c-407e-bad7-aa103d738d08"

Input Arguments

collapse all

File name to install, specified as a character vector or string. File name must be a valid toolbox installation file (*.mltbx). You can specify the file name as an absolute or relative path.

Whether to accept license agreement, specified as true or false. By default, agreeToLicense is false.

If an add-on contains a license agreement:

  • If agreeToLicense is false, then MATLAB displays a dialog box where you can accept the license or cancel installation.

  • If agreeToLicense is true, then MATLAB installs the add-on without opening the license agreement dialog box. By setting agreeToLicense to true, you accept the terms of the license agreement. Be sure that you have reviewed the license agreement before installing the add-on.

If an add-on does not have a license agreement, the value of agreeToLicense has no effect on installation.

Whether to overwrite or add the add-on, specified as 'overwrite' or 'add'. By default, installOption is set to 'overwrite'.

If a version of an add-on is already installed:

  • If installOption is 'overwrite', then MATLAB overwrites all previously installed versions of the add-on.

  • If installOption is 'add', then MATLAB installs the add-on without overwriting previously installed versions.

Output Arguments

collapse all

New add-on information, returned as a table with these columns.

FieldDescriptionType
NameName of the add-onString scalar
VersionVersion of the add-onString scalar
EnabledWhether the add-on is enabledLogical
IdentifierUnique identifier of the add-onString Scalar

Version History

Introduced in R2018b