As a nice follow up to last post, I'd like to introduce you to Amy Koh, who is a technical consultant in the MathWorks Consulting Services group. Amy focuses on the areas of application development, data analytics, system modelling and simulation, code generation, and deployment in production systems. Today is the start of a few posts where Amy will describe a common and important method for operationalizing MATLAB code, packaging and deploying toolboxes. This method is ideal when the users of your code have access to MATLAB. If this piques your interest then be sure to stay tuned for some more fun, tools, and best practices for creating and deploying toolboxes. Also, be sure to check out some of the recent posts on the MATLAB Community blogs for some cool related uses of toolboxes. Enjoy!
Creating and Sharing MATLAB Toolboxes
A toolbox is a collection of MATLAB files that can include code, data, apps, examples, and documentation. Before R2014b, there was no standard mechanism to package and distribute a MATLAB toolbox. This raised a number of questions:
How can you be sure that you had included all of the dependencies and set up the MATLAB path correctly?
How can you provide users a convenient way to install your toolbox?
How can users quickly access the examples and documentation to get started?
A new feature for packaging and distributing MATLAB files was introduced in MATLAB R2014b. This new functionality lets you easily share toolbox code with other MATLAB users via an .mltbx toolbox installer. This allows a toolbox to be installed with a single click, with MATLAB automatically managing all other installation details. You can access the toolbox packaging feature from the Add-Ons menu in MATLAB as shown below.
Packaging a Toolbox
The 'Package Toolbox' tool makes it easy to:
Package and distribute MATLAB files as a single .mltbx toolbox installer.
Specify toolbox metadata such as name, version, description, author etc.
Identify external file dependencies during the packaging process.
Include examples, apps and custom documentation in the toolbox.
Manage the toolbox installation process and MATLAB path configuration for end users.
Distinguish between new toolboxes and newer versions of existing toolboxes.
From R2015b onwards, you can view and manage your installed toolboxes using the Add-On Manager. It displays a list of all your installed add-ons and their versions. You can also view your installed content and uninstall any add-ons as shown in the screenshot below.
I hope I've convinced you to give toolbox packaging a try! And if you already have, please share your experiences and thoughts below.
Packaging toolboxes has made it easy to create and share toolboxes with other MATLAB users. One of our customers, Jaguar Land Rover, spoke about large scale adoption of MATLAB apps and toolboxes within their organisation at the MATLAB Expo UK 2016. We at MathWorks Consulting have seen some common challenges faced by our customers when using this feature in their development workflows. In upcoming blog posts, I will be sharing best practices and common pitfalls to avoid when packaging custom toolboxes in MATLAB, so stay tuned!
To leave a comment, please click here to sign in to your MathWorks Account or create a new one.