Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I package a MATLAB application that utilises toolboxes?

I want to package up an application in MATLAB for another team to use. They will have an appropriate version of MATLAB to run this application, but they might not necessarily have licenses for all the toolboxes used by the application.

Is there a way to "bundle" the toolboxes into the application so that they do not require expensive licenses to run it?

If not, is it possible to create a stand-alone/license independent MATLAB application a different way?

EDIT: Some of these applications might feature GUIs as well as command line interfaces.

like image 274
Samuel O'Malley Avatar asked Mar 21 '23 21:03

Samuel O'Malley


2 Answers

To generate code that can be run by MATLAB, you need the MATLAB Coder. The codegen command will generate the executables that can be run in MATLAB. Loren of MathWorks has a nice blog post on the product.

Here is an example of how to use codegen to create a MEX function from MATLAB code.

One big caveat is that with MATLAB Coder, the complete functionality of MATLAB is not yet available for compilation. This is because the generated binaries do not require the MATLAB Compiler Runtime (MCR), which is essentially a headless MATLAB virtual machine. Instead MATLAB Coder generates C code that is truly standalone, but the code generation is somewhat limited as a result. Here is a description of the subset of functionality, and here are complete lists of functions supported. Most toolkit functions appear to be supported according to the categorical list.

If the required functions are not supported, then it will be necessary to use the Compiler to generate standalone libraries and roll your own MEX interface to those libraries, as MrAzzaman indicated. Another possibilities is to use the loadlibrary function to directly load the Compiler-generate libraries, although I have never tried this last option. If you can't successfully interface with these libraries back in MATLAB, the MATLAB compiler can of course be used to generate a standalone executable. The deploytool simplifies the process of packaging the code and its dependencies.

like image 98
chappjc Avatar answered Mar 30 '23 01:03

chappjc


The MATLAB Compiler sounds like exactly what you need. Unfortunately, it is a separate Toolbox which you would have to purchase.

EDIT: I should note that this will compile your MATLAB code into an application/library, not MATLAB code. The other team would still be able to use it with MATLAB, I believe, but I don't think they would be able to see the code itself.

like image 21
MrAzzaman Avatar answered Mar 30 '23 00:03

MrAzzaman