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!
5 CommentsOldest to Newest
Thanks, This area is very interesting to me and I look forward to the subsequent posts.
One thing I am not so clear on is the distinction between “Add-on”, “App” & “Toolbox”. Reading up the help it seems to be that Apps & Toolboxes are Add-ons, but are there other types of Add-on? Is a major product like Simulink an Add-on?
Thanks for your comment! MATLAB add-ons include apps, toolboxes, support packages, products and more.
MATLAB apps are interactive graphical applications written to perform technical computing tasks and can be launched from the ‘APPS’ tab of the MATLAB Toolstrip. On the other hand, a toolbox is a collection of MATLAB files that can include code, data, examples, documentation and even apps! I will write more about this in my following posts.
Essentially, add-ons extend the capabilities of MATLAB by providing additional functionality for specific tasks and applications. They can be community-authored, and shared with other users via File Exchange for example, or they can be MathWorks products such as Simulink. You can easily browse, search, and install all available add-ons using the ‘Add-On Explorer’ in MATLAB:
This is a great feature by itself. As I understood there is no mechanism of notifying the user about new versions of app/toolbox, nor autoupdate. This is what stopped me from adopting it. I ended up inventing the wheel around a git repository.
You are correct, currently there is no built-in mechanism to notify users or perform updates automatically when new versions of an app or toolbox become available. Having said that, you can write a custom tool in MATLAB to manage and coordinate updates using the app or toolbox management APIs. Have a look at the following demo, written by my colleague David Sampson, on sharing and managing your MATLAB toolboxes using the MATLAB Minimart demo!
[…] 14 Dec Give Them a Care Package […]