matlab.addons.toolbox.ToolboxOptions
R2026bDescription
Use ToolboxOptions to specify custom options when building a
package. After you create a ToolboxOptions object, use the
matlab.addons.toolbox.packageToolbox function to build the
package.
Creation
Syntax
Description
creates a opts = matlab.addons.toolbox.ToolboxOptions(packageFolder,identifier)ToolboxOptions object using the files in the specified package
folder and the specified unique identifier.
If the package folder contains a package definition file,
matlab.addons.toolbox.ToolboxOptions uses information from the
package such as the description, summary, and package name to set properties of the
ToolboxOptions object. For more information about packages, see MATLAB Packages and Package Dependencies.
specifies one or more property values using name-value arguments. For example,
opts = matlab.addons.toolbox.ToolboxOptions(packageFolder,identifier,PropertyName=Value)matlab.addons.toolbox.ToolboxOptions(packageFolder,identifier,MaximumMatlabRelease="R2023a")
sets the latest MATLAB® release with which the package is compatible to R2023a.
When setting properties for a package containing a package definition file,
matlab.addons.toolbox.ToolboxOptions uses the values of the
specified name-value arguments instead of the information from the package to set
properties.
creates a opts = matlab.addons.toolbox.ToolboxOptions(projectFile)ToolboxOptions object using the information in the specified
package project file (.prj or .toml).
Input Arguments
Folder containing the files for the package, specified as a string scalar or
character vector. When specifying packageFolder, include the
relative or absolute path to the folder.
Example: "C:\Work\myPackageFolder"
Unique identifier of the package, specified as a string scalar or character
vector. identifier must follow the RFC 4122 specification which
defines a Uniform Resource Name namespace for UUIDs (Universally Unique Identifier).
For more information, see https://www.rfc-editor.org/info/rfc4122.
In addition, identifier must be the same across all versions
of the package. Otherwise, MATLAB installs each version of the package as a new package instead of a new
version of the package. If the package folder contains a package definition file,
mpackage.json,
identifier must be the same as the identifier defined in the
package.
To get the unique identifier for an existing installed package, use the matlab.addons.installedAddons function. For example:
addons = matlab.addons.installedAddons
addons =
1×4 table
Name Version Enabled Identifier
___________________________ _________ _______ ______________________________________
"Random File Name Creator" "1.0" true "75442144-f751-4011-bf0e-32b6fb2f1433"
Example: "e5af5a78-4a80-11e4-9553-005056977bd0"
Project file (.prj or
.toml), specified as a string scalar or
character vector. When specifying projectFile, include the
relative or absolute path to the file. The specified MATLAB project must contain exactly one package task. (since R2025a)
For a package created before R2025a, you can specify
projectFile as the package project file
(.prj).
Example: "myPackage.prj"
Example: "C:\Work\myOtherPackage.toml"
Properties
Package display name, specified as a string scalar or character vector. If you do
not specify ToolboxName, then MATLAB derives the name from the package folder name.
When a package is installed, ToolboxName provides the value for
the displayName property of the corresponding mpackage.json
file.
Since R2026b
Package name, specified as a string scalar or character vector.
PackageName must be a valid MATLAB identifier. If you do not specify PackageName, then
MATLAB derives the name from the package folder name.
When a package is installed, PackageName provides the value for
the name property of the corresponding mpackage.json
file.
Version number of the installed application, specified as a string scalar or character vector containing a valid semantic version.
Version syntax follows the Semantic
Versioning 2.0.0 format: ,
where each version number must be a nonnegative integer, for example
<major
version>.<minor
version>.<patch version>1.2.3. You can optionally specify a pre-release version by adding
- to the end
of the version, for example <pre-release version>1.2.3-alpha. Optionally specify a build
version by adding +<build
version>.
When a package is installed, ToolboxVersion provides the value
for the version property of the corresponding mpackage.json
file.
Summary description of the package, specified as a string scalar or character vector.
When a package is installed, Summary provides the value for the
summary property of the corresponding mpackage.json
file.
Since R2026b
Path to Readme file, specified as a string scalar or character vector. Use this Readme file to provide information for users on how to use your package.
When a package is installed, Readme provides the value for the
readme property of the corresponding mpackage.json
file.
Before R2026b: Use the Description
property to store information on how to use your package.
Package author name, specified as a string scalar or character vector.
When a package is installed, AuthorName provides the value for
the name subproperty of the provider property of
the corresponding mpackage.json
file.
Package author email address, specified as a string scalar or character vector.
When a package is installed, AuthorEmail provides the value for
the email subproperty of the provider property of
the corresponding mpackage.json
file.
Package author company name, specified as a string scalar or character vector.
When a package is installed, AuthorCompany provides the value
for the organization subproperty of the provider
property of the corresponding mpackage.json
file.
Path to the package image file, specified as a string scalar or character vector. The path can be a relative path or an absolute path.
Files to be packaged in the package, specified as a character vector, string vector,
or cell array of character vectors. By default, ToolboxFiles
contains the list of all files in packageFolder.
When specifying ToolboxFiles, include the relative or absolute
paths to the files. If you specify a folder, MATLAB adds all of the files in the folder to
ToolboxFiles.
Folders to add to MATLAB path during package installation, specified as a string vector, character
vector, or cell array of character vectors. When specifying
ToolboxMatlabPath, include the relative or absolute paths to the
folders.
Package apps gallery files, specified as a string vector, character vector, or cell
array of character vectors. Apps gallery files are MATLAB executable files (.m, .mex,
.mlx, .mlapp, .p) to add to
apps gallery during package installation. When specifying
AppGalleryFiles, include the relative or absolute paths to the
files.
Files included in AppGalleryFiles must also be included in
ToolboxFiles.
Path to the package Getting Started Guide, specified as a string scalar or character
vector. The Getting Started Guide is a MATLAB code file (.m, .mlx) containing a
quick start guide for your package. The path can be a relative path or an absolute
path.
Path to the package output file, specified as a string scalar or character vector.
The path can be a relative path or an absolute path. If the file does not have a
.mltbx extension, MATLAB appends the extension automatically when it creates the file.
Latest MATLAB release that the package is compatible with, specified as a string scalar
or character vector using the format
, for example,
RXXXXx"R2023a". If there is no maximum restriction, specify
MaximumMatlabRelease as empty ("").
When a package is installed, MaximumMatlabRelease and
MinimumMatlabRelease are used to generate the value for the
releaseCompatibility property of the corresponding mpackage.json
file.
Earliest MATLAB release that the package is compatible with, specified as a string scalar
or character vector using the format
, for example,
RXXXXx"R2020a". If there is no minimum restriction, specify
MinimumMatlabRelease as empty ("").
When a package is installed, MaximumMatlabRelease and
MinimumMatlabRelease are used to generate the value for the
releaseCompatibility property of the corresponding mpackage.json
file.
Platforms that the package supports, specified as a scalar struct with these fields.
| Field | Description |
|---|---|
Glnxa64 | Whether the package supports glnxa64 systems,
specified as true (default) or
false |
Mac | Whether the package supports Mac systems, specified as
true(default) or false |
MatlabOnline | Whether the package supports MATLAB
Online™, specified as true (default) or
false |
Win64 | Whether the package supports win64 systems, specified
as true (default) or false |
When a package is installed, SupportedPlatforms provides the
value for the supportedPlatforms property of the corresponding
mpackage.json
file.
Files to add to the Java class path during package installation, specified as a
string vector, character vector, or cell array of character vectors. When specifying
ToolboxJavaPath, include the relative or absolute paths to the
files.
When a package is installed, files in ToolboxJavaPath are added
to the folders property of the corresponding mpackage.json
file.
Since R2026b
Package dependencies, specified as a matlab.mpm.Dependency array. Package dependencies are other packages that
the package depends on. If a package has no dependencies, then this property contains an
empty string.
Before R2026b: Use the RequiredAddons
property to specify other add-ons to be downloaded and installed during package
installation, specified as a struct vector with these fields:
| Field | Description |
|---|---|
Name | Name of required add-on, specified as a string scalar or character vector |
Identifier | Unique identifier of the add-on, specified as a string scalar or character vector |
EarliestVersion | Earliest add-on version that the package is compatible with, specified as a string scalar or character vector |
LatestVersion | Latest add-on version that the package is compatible with, specified as string scalar or character vector |
DownloadURL | URL to download the add-on, specified as a string scalar or character vector |
When a package is installed, files in PackageDependencies are
added to the dependencies property of the corresponding
mpackage.json
file.
Additional required software packages to be downloaded and installed during package installation, specified as a struct vector with these fields.
| Field | Description |
|---|---|
Name | Name of software package, specified as a string scalar or character vector |
Platform | Platform to download the additional software package for, specified as
"win64", "mac", or
"glnxa64" |
DownloadURL | URL to download the additional software package, specified as a string scalar or character vector |
LicenseURL | URL for the software package license file, specified as a string scalar or character vector |
Since R2026b
Enable license BSD, specified as false (0) or
true (1). Set this property to
true to add a BSD license to the package during packaging. The BSD
license includes the author company (or author name if no company is set) and the
current year.
UseLicenseBSD must be true for package files
(.mltbx) uploaded to File
Exchange.
Since R2026b
Custom labels, specified as a string array where each element contains a custom label. Use this property to add labels to make your package more easily searchable.
When a package is installed, Tags provides the value for the
tags property of the corresponding mpackage.json
file.
Since R2026b
MathWorks product dependencies, specified as a string array where each element
contains the name of a MathWorks product. Product names must be an exact match. Use ver to list all installed products.
Object Functions
matlab.addons.toolbox.packageToolbox | Build package from project file |
Examples
Use a ToolboxOptions object to build a package
named My Package that is supported on all platforms except macOS and is compatible with R2026b and later releases. The package also has one
required add-on and one required additional software package.
identifier = "a3d07955-9c3d-4ff5-8c75-7ddcff3c759e"; packageFolder = "C:\Work\myPackage"; opts = matlab.addons.toolbox.ToolboxOptions(packageFolder,identifier); opts.ToolboxName = "My Package"; opts.SupportedPlatforms.Win64 = true; opts.SupportedPlatforms.Mac = false; opts.SupportedPlatforms.Glnxa64 = true; opts.SupportedPlatforms.MatlabOnline = true; opts.MinimumMatlabRelease = "R2026b"; opts.MaximumMatlabRelease = ""; opts.PackageDependencies = matlab.mpm.Dependency(... "Gui Layout Toolbox", ... ">=4.2.0", ... "e5af5a78-4a80-11e4-9553-005056977bd0"); opts.RequiredAdditionalSoftware = ... struct("Name","Dataset", ... "Platform","glnxa64", ... "DownloadURL","https://github.com/myusername/myproject/data.zip", ... "LicenseURL","https://github.com/myusername/myproject/LICENSE"); matlab.addons.toolbox.packageToolbox(opts);
Use a ToolboxOptions object to build an app named
My App and add the app to the apps gallery during app
installation.
appUuid = "e4a1c2b9-7f3a-41b2-8e6d-2f9a4c1b7e5f"; appFolder = pwd; appFile = fullfile(pwd,"myApp.m"); opts = matlab.addons.toolbox.ToolboxOptions(appFolder,appUuid,ToolboxName="My App", ... ToolboxFiles=appFile,AppGalleryFiles=appFile,ToolboxMatlabPath={"."}); matlab.addons.toolbox.packageToolbox(opts);
Use a ToolboxOptions object to build a package from
a project file.
projectFile = "myPackage.prj";
opts = matlab.addons.toolbox.ToolboxOptions(projectFile);
matlab.addons.toolbox.packageToolbox(opts);Version History
Introduced in R2023aUse the Tags property to add custom labels to your package. Use this
property to add labels to make your package more easily searchable.
Use the UseLicenseBSD property to generate a BSD license when
building a package. The BSD license includes the author company (or author name if no
company is set) and the current year.
UseLiscenseBSD must be true for package files
(.mltbx) uploaded to File
Exchange
Use the ProductDependencies property to set MathWorks products as required dependencies. Product names must be an exact match. Use
ver to list all installed products.
The ToolboxVersion property must adhere to semantic version syntax.
ToolboxVersion syntax follows the Semantic Versioning 2.0.0 format:
,
where each version number must be a nonnegative integer, for example,
<major>.<minor>.<patch>1.2.3. You can optionally specify a pre-release version by adding
- to the end of
the version, for example, <pre-release version>1.2.3-alpha. Optionally specify a build version
by adding +.<build version>
The Description and RequiredAddons properties are
no longer supported. Use the Readme property to direct users to a file
containing important information about your package. Use the
PackageDependencies property define packages that your package depends
on.
The Maci64 field for the SupportedPlatform
name-value argument is no longer supported. This is because MATLAB is no longer available for Macs with Intel® processors. To specify macOS support, use the Mac field instead.
In addition, the "maci64" value for the Platform
field for the RequiredAdditionalSoftware name-value argument is no longer
supported. To download an additional software package for macOS, use the "mac" value instead.
The identifier argument, used to specify the unique identifier of a
package,, must follow the RFC 4122 specification which defines a Uniform Resource Name
namespace for UUIDs (Universally Unique Identifier). For more information, see
https://www.rfc-editor.org/info/rfc4122.
Previously, identifier only had to follow the RFC 4122
specification when sharing a package on MATLAB File Exchange.
You can now create a ToolboxOptions object by specifying
projectFile as a MATLAB project file that contains a package task. For more information, see Interactively Create and Share Packages.
Previously, projectFile supported only package project
files.
The MATLAB language feature known as a toolbox is now
a package, and the associated installation file
(.mltbx) is now a package file.
Packages are collections of code bundled for distribution. As of R2026b, the terminology is
updated in both the documentation and software.
Package installation is handled by MATLAB Package Manager, which provides robust dependency management. MATLAB Package Manager is backward compatible with toolboxes created before R2026b. These toolboxes are supported and installed as packages.
You can interactively build a package in two ways:
If your code is in a MATLAB project, convert the project to the new TOML format, which enables the project to depend on packages. Open the project, go to the Project tab, and in the Tools section, click Build Package. MATLAB creates a package task with the same name as your project and opens it in the document area of the desktop.
If your files are not already included in a project, go to the Home tab, and in the Environment section, select Add-Ons > Build Package. Click Browse to select the folder containing your package files and then click OK. MATLAB creates a new project containing your files and a package task for configuring your package. If the folder you select already contains a project, the existing project is used instead. Configure the project to use the recommended TOML format.
To support MATLAB Package Manager functionality, the matlab.addons.toolbox.ToolboxOptions object includes four new properties:
PackageName, PackageDependencies, and
Readme.
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)