Main Content

Create and Share Toolboxes

You can package MATLAB® files to create a toolbox to share with others. These files can include MATLAB code, data, apps, examples, and documentation. When you create a toolbox, MATLAB generates a single installation file (.mltbx) that enables you or others to install your toolbox.

Create Toolbox

Starting in R2025a, toolbox packaging is integrated with projects. To create a toolbox from your files, create a toolbox task within a project. Then, use the toolbox task to configure and package your toolbox.

Before R2025a: To create your toolbox, go to the Home tab, and in the Environment section, select Add-Ons > Package Toolbox. Then, in the Package a Toolbox dialog box, click the plus button and select your toolbox folder. Configure your toolbox and then click Package to create your toolbox installation file.

Create Toolbox Task

The first step to creating a toolbox is to create a toolbox task. You can then use the toolbox task to configure and package your toolbox.

There are two ways to create a toolbox task:

  • If your toolbox files are already included in a project, open the project, go to the Project tab, and in the Tools section, click Package Toolbox. MATLAB creates a toolbox 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 > Package Toolbox. Click Browse to select the folder containing your toolbox files, and click OK. MATLAB creates a new project containing your files and a toolbox task for configuring your toolbox. If the folder you select already contains a project, the existing project is used instead.

To reopen the toolbox task after closing it, go to the Project tab and click Package Toolbox. You also can click Compiler Task Manager to view all the toolbox tasks in the project.

Specify Toolbox Folder

The Toolbox Folder section shows the toolbox folder and a preview of the files in the toolbox. To add the toolbox folder, click the Add Toolbox Folder button. After adding the toolbox folder, to change it, click the Change Toolbox Folder button.

By default, MATLAB excludes source control and project resource files from the toolbox. In addition, if your toolbox contains a P-code file and a MATLAB code file (.m) with the same name in the same folder, MATLAB excludes the .m file from the toolbox. To show the excluded files in the preview, click the Toggle Display of Exclusions button. To exclude other files or folders from the toolbox, click the Edit Exclusions button and add them to the text file that opens. It is good practice to exclude any source control files related to your toolbox.

Specify Toolbox Information

In the Toolbox Information section, specify the information about your toolbox, as described in the table.

If your toolbox folder contains a package definition file, MATLAB uses the package information, such as the description, summary, and toolbox name, to automatically prepopulate some of the toolbox information fields when creating the toolbox task. You can then further edit these fields. For more information about packages, see Create and Manage Packages.

Toolbox Information FieldDescription
Toolbox name

Enter the toolbox name, if necessary. By default, the toolbox name is the name of the toolbox folder.

Version

Enter the toolbox version number in the major.minor.bug.build format. bug and build are optional.

Author name, Email, and Company

Enter contact information for the toolbox author.

Toolbox image

Point to the image at the top-left corner of the section and click Browse to select an image that represents your toolbox. The image must be in the project folder.

Summary and Description

Enter the toolbox summary and description. It is good practice to keep the Summary text brief and to add detail to the Description text.

Review Toolbox Requirements

MATLAB automatically analyzes your toolbox files and detects requirements to include with your toolbox. The Toolbox Requirements section shows these requirements. To ensure your toolbox includes all required files, review the detected requirements as described in the table and resolve warnings, if necessary.

Toolbox Requirements FieldDescription
Required Add-ons

Specify the list of add-ons required for your toolbox. Specified add-ons are downloaded and installed when the toolbox is installed. MATLAB automatically populates this list with the add-ons it determines the toolbox requires and specifies them all by default. You can choose to omit any add-ons you do not want to install with your toolbox.

If MATLAB is unable to find the installation information for an add-on in the list, you must enter a download URL. The download URL is the location where MATLAB can download and install the add-on. When the toolbox is installed, MATLAB installs the add-on using the specified URL.

Discovered Requirements

Specify the list of the files required for your toolbox that are located outside the toolbox folder. MATLAB automatically populates this list with the files it determines the toolbox requires and specifies them all by default. You can choose to omit any files you do not want in your toolbox.

Click the View Analysis button to view the analysis in the Dependency Analyzer. To rerun the analysis, click the Reanalyze button.

Specify Output Settings

The Output Settings section shows the filename and path for your toolbox installation file (.mltbx). By default, the output filename is the toolbox name and the path to the file is the release folder in the project root folder.

To change the filename and path for your toolbox installation file, enter a new filename with a .mltbx extension and click Browse to select a different output path.

Add Install Actions (Optional)

The Install Actions section shows the additional actions that occur when your toolbox is installed, including setting the MATLAB path and the Java Classpath, installing apps, and opening the Getting Started guide. You can configure the install actions, as described in the table.

Install Actions FieldDescription
MATLAB Path

Specify the list of folders that are added to the user’s MATLAB path when they install the toolbox. By default, the list includes any of the toolbox folders that are on your project path. You can exclude folders from being added to the user’s path by clearing them from the list. To manage the path for toolbox installation, click Manage Project Path. To reset the list to the default list, click Restore Default Path.

Java Classpath

Specify the list of Java® files that are added to the user’s Java classpath when they install the toolbox. Upon toolbox installation, the JAR files are added to the dynamic path for the duration of the MATLAB session. When the toolbox user restarts MATLAB, the JAR files are added to the static path.

Apps

Specify the published MATLAB installable apps associated with your toolbox.

  • To specify which apps (.mlapp files) are also installed and registered in the user's MATLAB apps gallery, click the Add button and select the apps. Alternatively, right-click the file in the Project panel, click Add Label, and select the App Gallery File label in the toolbox task menu.

  • All .mlappinstall files in your toolbox folder are installed and registered in the user's MATLAB apps gallery.

Getting Started Guide

Specify a Getting Started guide for your toolbox. For the toolbox task to recognize a Getting Started guide, include the guide as a live script named GettingStarted.mlx in a doc subfolder within your toolbox folder. Then, in the Project panel, right-click the file, click Add Label, and select the Getting Started Guide label in the toolbox task menu. Alternatively, you can generate and edit GettingStarted.mlx by clicking the Add button.

Users of your toolbox can view the Getting Started guide through the Options menu for the toolbox in the Add-Ons panel. For more information, see Get and Manage Add-Ons.

Configure Toolbox Portability

MATLAB uses the information in the Toolbox Portability section when the user installs the toolbox. If the compatibility check fails because the user has an unsupported platform or MATLAB release, MATLAB displays a warning. However, the user still can install the toolbox.

Toolbox Portability FieldDescription
Supported Platforms

Specify the platforms that support the toolbox. Consider if your toolbox has third-party software or hardware requirements that are platform specific. MATLAB Online™ cannot interact with hardware, including devices used for image acquisition and instrument control.

Release Compatibility

Specify the MATLAB releases that support the toolbox.

Add Third-Party Software (Optional)

The Third-Party Software section lists additional third-party software ZIP files that are installed on the user's system when the user installs the toolbox. To add additional third-party software to install with your toolbox, click the Add button and specify these fields:

  • Software Name — The name to display to the user during installation.

  • Platform — The platform that the additional software runs on.

  • Download URL — The URL to the ZIP file that contains the additional software. To specify different download URLs for different platforms, add separate entries for each platform.

  • License URL — The URL of the additional software license agreement to display to the user during installation. The user is prompted to review and agree to the license agreement during installation. You must specify a valid URL to the license agreement.

When the user installs a toolbox, MATLAB installs all additional third-party software in the addons\Toolboxes\AdditionalSoftware folder, where addons is the default add-ons installation folder. For more information about the location of the default add-ons installation folder, see Get and Manage Add-Ons.

If your toolbox contains code that refers to the installation folder of the specified additional third-party software, make these references portable to other computers. Replace the references with calls to the generated function toolboxname\getInstallationLocation.mlx, where toolboxname is the name of your toolbox. For example, if you are creating a toolbox named mytoolbox and want to reference the install location for additional software named mysoftware, replace this code

mysoftwarelocation = 'C:\InstalledSoftware\mysoftware\'
with this code:
mysoftwarelocation = mytoolbox.getInstallationLocation('mysoftware')

Package Toolbox

After configuring your toolbox, follow these steps to create a toolbox installation file (.mltbx):

  1. Click the Reanalyze button at the top of the toolbox task, to check your toolbox for issues. Resolve any errors before proceeding.

  2. Click the Package Toolbox button at the top-right corner of the toolbox task to create your toolbox installation file (.mltbx). MATLAB creates the file in the folder specified in the Output Settings section.

Share Toolbox

To share your toolbox with others, distribute the toolbox installation file (.mltbx) to them. All files you added when you packaged the toolbox are included in the file. When the end users install your toolbox, the installation file manages their MATLAB path and other installation details.

For information on installing, uninstalling, and viewing information about toolboxes, see Get and Manage Add-Ons.

You can share your toolbox with others by attaching the toolbox installation file to an email message or using any other method you typically use to share files, such as uploading to MATLAB Central File Exchange. If you upload your toolbox to File Exchange, your users can download the toolbox from within MATLAB. For more information, see Get and Manage Add-Ons.

Note

Although toolbox installation files can contain any files you specify, MATLAB Central File Exchange places additional limitations on submissions. Data and image files are typically acceptable. However, you cannot submit your toolbox to File Exchange if it contains any of these types of files:

  • MEX files

  • Other binary executable files, such as DLL files or ActiveX® controls

Upgrade Toolbox Created in Previous Release

If you have a toolbox created in a release before R2025a as well as its associated .prj file, MATLAB can automatically upgrade your toolbox to the project workflow.

To upgrade your toolbox, open the .prj file by double-clicking it in the Files panel. MATLAB automatically creates a project and adds your toolbox files and information to a new toolbox task. Verify the toolbox information and then package your toolbox using the workflow described in Package Toolbox.

See Also

Functions

Topics