Main Content

matlab.addons.toolbox.packageToolbox

Package toolbox project

Description

example

matlab.addons.toolbox.packageToolbox(projectFile) packages the toolbox project file (.prj file) into a MATLAB® toolbox file (.mltbx file). The name of the resulting MATLAB toolbox file is the name of the toolbox appended with the .mltbx extension. For example, toolboxname.mltbx.

For you to package a toolbox, the toolbox root folder and the toolbox files must be in the same location as when you created the toolbox project file.

example

matlab.addons.toolbox.packageToolbox(projectFile,outputFile) packages the toolbox and saves the .mltbx file with the name and location specified by outputFile.

example

matlab.addons.toolbox.packageToolbox(opts) packages the toolbox and toolbox options specified by the ToolboxOptions object opts. (since R2023a)

Examples

collapse all

Assume that you have the myToolbox.prj toolbox project file in your current working folder. Package the toolbox in the same folder.

projectFile = "myToolbox.prj";
matlab.addons.toolbox.packageToolbox(projectFile)

Assume that you have the myToolbox.prj toolbox project file in your current working folder. Package the toolbox as myFavoriteToolbox.mltbx.

projectFile = "myToolbox.prj";
outputFile = "myFavoriteToolbox";
matlab.addons.toolbox.packageToolbox(projectFile,outputFile)

Since R2023a

Use a ToolboxOptions object to package a toolbox named My Toolbox that is supported on all platforms except macOS and is compatible with R2017b and later releases. The toolbox also has one required add-on and one required additional software package.

uuid = "myToolboxUuid";
toolboxFolder = "C:\Work\myToolbox";
opts = matlab.addons.toolbox.ToolboxOptions(toolboxFolder, uuid);

opts.ToolboxName = "My Toolbox";
 
opts.SupportedPlatforms.Win64 = true;
opts.SupportedPlatforms.Maci64 = false;
opts.SupportedPlatforms.Glnxa64 = true;
opts.SupportedPlatforms.MatlabOnline = true;

opts.MinimumMatlabRelease = "R2017b";
opts.MaximumMatlabRelease = "";

opts.RequiredAddons = ...
    struct("Name", "Gui Layout Toolbox", ...
           "Identifier", "e5af5a78-4a80-11e4-9553-005056977bd0", ...
           "EarliestVersion", "1.0", ...
           "LatestVersion", "4.0", ...
           "DownloadURL", "");

opts.RequiredAdditionalSoftware = ...
    struct("Name", "Dataset", ...
           "Platform", "common", ...
           "DownloadURL", "https://github.com/myusername/myproject/data.zip", ...
           "LicenseURL", "https://github.com/myusername/myproject/LICENSE");

matlab.addons.toolbox.packageToolbox(opts);

Input Arguments

collapse all

Name of the toolbox project file (.prj file), specified as a character vector or string scalar. The name includes the relative or absolute path to the file.

Example: "myToolbox.prj"

Example: "C:\Work\myOtherToolbox.prj"

Name of the output MATLAB toolbox file (.mltbx file), specified as a character vector or string scalar. The name includes the relative or absolute path to the file. If the value of outputFile does not contain the .mltbx extension, the packageToolbox function appends the extension.

Example: "myToolbox.mltbx"

Example: "C:\Work\myOtherToolbox"

Since R2023a

Toolbox options, specified as a ToolboxOptions object.

Alternatives

You can package toolboxes from the Package a Toolbox UI. For more information, see Create and Share Toolboxes.

Version History

Introduced in R2016a

expand all