Main Content

matlab.addons.install

Install add-on

Description

example

newAddon= matlab.addons.install(文件名installs the add-on specified by文件名。如果一个版本的插件已经安装,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, seeGet and Manage Add-Ons

matlab.addons.installonly supports installing toolboxes.

example

newAddon= matlab.addons.install(文件名,agreeToLicenseaccepts the license agreement before installing the add-on ifagreeToLicenseistrue

example

newAddon= matlab.addons.install(文件名,installOptioninstalls the add-on without overwriting previously installed versions ifinstallOptionis'add'。Otherwise, if a version of the add-on is already installed, MATLAB overwrites the previous version.

newAddon= matlab.addons.install(文件名,agreeToLicense,installOptioninstalls the add-on using the specified license and install options.

Examples

collapse all

Assume that you have theMy toolbox.mltbxtoolbox file in yourC:\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 version2.0of a toolbox calledMy Toolboxinstalled on your system. Install version4.0of the toolbox without overwriting version2.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 astrueorfalse。By default,agreeToLicenseisfalse

If an add-on contains a license agreement:

  • IfagreeToLicenseisfalse, then MATLAB displays a dialog box where you can accept the license or cancel installation.

  • IfagreeToLicenseistrue, then MATLAB installs the add-on without opening the license agreement dialog box. By settingagreeToLicensetotrue, 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 ofagreeToLicensehas no effect on installation.

Whether to overwrite or add the add-on, specified as'overwrite'or'add'。By default,installOptionis set to'overwrite'

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

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

  • IfinstallOptionis'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.

Field Description Type
Name 插件的名称 String scalar
Version Version of the add-on String scalar
Enabled Whether the add-on is enabled Logical
Identifier Unique identifier of the add-on String Scalar

Version History

Introduced in R2018b