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

To create a toolbox installation file:

  1. In the Environment section of the Home tab, select Package Toolbox from the Add-Ons menu.

  2. In the Package a Toolbox dialog box, click the button and select your toolbox folder. It is good practice to create the toolbox package from the folder level above your toolbox folder. The .mltbx toolbox file contains information about the path settings for your toolbox files and folders. By default, any of the included folders and files that are on your path when you create the toolbox appear on their paths after the end users install the toolbox.

  3. In the dialog box, add the following information about your toolbox.

    Toolbox Information FieldDescription
    Toolbox Name

    Enter the toolbox name, if necessary. By default, the toolbox name is the name of the toolbox folder. The Toolbox Name becomes the .mltbx file name.

    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. To save the contact information, click Set as default contact.

    Toolbox Image

    To select an image that represents your toolbox, click Select toolbox image.

    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.

  4. To ensure MATLAB detects the expected components, review the toolbox contents. The following sections of the Package a Toolbox dialog box appear after you select a toolbox folder.

    Package a Toolbox Dialog Box SectionDescription
    Toolbox Files and Folders

    List of the folders and files contained in your toolbox. The listed files and folders are only those files that are located in the top level of the toolbox folder. You cannot navigate through the folders in the Toolbox Packaging dialog box. To exclude a file or folder from the toolbox, register it in the text file that is displayed when you click Exclude files and folders. It is good practice to exclude any source control files related to your toolbox.

    External Files

    List of the files required for your toolbox that are located outside the toolbox folder. By default, MATLAB includes the required files. You can choose to omit any files you do not want in your toolbox.

    Install Actions

    MATLAB Path—List of folders that are added to the user's MATLAB path when they install a toolbox. By default, the list includes any of the toolbox folders that are on your path when you create the toolbox. You can exclude folders from being added to the user's path by clearing them from the list. To manage the path for when a toolbox is installed, click Manage the current MATLAB path. To reset the list to the default list, click Reset to the current MATLAB path.

    Java Class Path—List of Java® files that are added to the user's dynamic Java class path when they install a toolbox. For more information, see Manage Java Class Path for Toolboxes.

    Products

    List of MathWorks® products required by your toolbox. Create this list manually.

    Examples, Apps, and Documentation

    List of published MATLAB examples, installable apps, and custom documentation associated with your toolbox.

    • For the Package a Toolbox tool to recognize examples, first publish them to HTML in MATLAB. Include the code files and the HTML files in your toolbox folder.

      • For a live script (.mlx) example, export it to HTML. On the Live Editor tab, select Save > Export to HTML and save it in a folder named html.

      • For a script (.m) example, publish it to HTML with the publish function. Do not specify an output folder when publishing your examples. For the Package a Toolbox tool to recognize the examples, the output folder must be the default folder (html).

      To create different categories for your examples, place the examples in different subfolders within your toolbox folder. When you add your toolbox folder to the Package a Toolbox dialog box, MATLAB creates a demos.xml file to describe your examples, and takes the example subfolder name as the example category name. Alternatively, you can create your own demos.xml file. The demos.xml file allows recipients to access your examples through the Supplemental Software link at the bottom of the Help browser home page. For more information, see Display Custom Examples.

    • For the Package a Toolbox tool to recognize apps, first package the app into a .mlappinstall file. For more information, see Package Apps From the MATLAB Toolstrip.

    • For the Package a Toolbox tool to recognize custom documentation, include an info.xml file to identify your documentation files. If you use the builddocsearchdb function to build the documentation database before packaging your toolbox, you can include the generated helpsearch subfolder in your toolbox. The info.xml file and the helpsearch folder allow recipients to access your documentation through the Supplemental Software link at the bottom of the Help browser home page. For more information, see Display Custom Documentation.

      Alternatively, you can generate info.xml and helptoc.xml template files from the Package a Toolbox dialog box. To access your documentation through the Help browser, complete the documentation templates and include info.xml on the MATLAB path.

  5. Click Package at the top of the Package a Toolbox dialog box. Packaging your toolbox generates a .mltbx file in your current MATLAB folder.

    When you create a toolbox, MATLAB generates a .prj file that contains information about the toolbox and saves it frequently. It is good practice to save this associated .prj file so that you can quickly create future revisions of your toolbox.

Share Toolbox

To share your toolbox with others, give them the .mltbx file. All files you added when you packaged the toolbox are included in the .mltbx file. When the end users install your toolbox, they do not need to be concerned with the MATLAB path or other installation details. The .mltbx file manages these details for end users.

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

You can share your toolbox with others by attaching the .mltbx 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 Add-Ons.

    Note:   While .mltbx files can contain any files you specify, MATLAB Central File Exchange places additional limitations on submissions. If your toolbox contains any of the following, it cannot be submitted to File Exchange:

    • MEX-files.

    • Other binary executable files, such as DLLs or ActiveX® controls. (Data and image files are typically acceptable.)

See Also

| | | | |

Related Examples

Was this topic helpful?