matlab.addons.toolbox.packageToolbox - Package toolbox project - MATLAB (original) (raw)

Syntax

Description

matlab.addons.toolbox.packageToolbox([projectFile](#mw%5Fa664bde3-822f-44e9-86bc-3d38713de949)) 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](#mw%5Fa664bde3-822f-44e9-86bc-3d38713de949),[outputFile](#bu582lx-1-outputFile)) packages the toolbox and saves the .mltbx file with the name and location specified by outputFile.

example

matlab.addons.toolbox.packageToolbox([opts](#mw%5F4827c610-341b-4a52-9e53-1e5c87740cc6)) packages the toolbox and toolbox options specified by theToolboxOptions object opts. (since R2023a)

example

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

Project file (.prj), 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 toolbox task. (since R2025a)

For a toolbox created before R2025a, you can specifyprojectFile as the toolbox project file (.prj).

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"

Version History

Introduced in R2016a

expand all

You can now create a ToolboxOptions object by specifyingprojectFile as a MATLAB project file that contains a toolbox task. For more information, seeCreate and Share Toolboxes.

Previously, projectFile supported only toolbox project files.

When packaging a toolbox, you can specify packaging options using aToolboxOptions object. Using theToolboxOptions object, you can specify information about the toolbox, including the platforms it supports and the MATLAB releases that the toolbox is compatible with. You also can specify the files to package and additional software to install with the toolbox.