How can I distribute my standalone application with a minimal MATLAB Runtime installation?

47 visualizzazioni (ultimi 30 giorni)
I've developed a MATLAB application and aim to compile it with MATLAB Compiler and then distribute it as compactly as possible. Is there a way to avoid installing the full MATLAB Runtime if my compiled application only requires a few specific toolboxes?

Risposta accettata

MathWorks Support Team
MathWorks Support Team il 11 Lug 2025
Modificato: MathWorks Support Team il 11 Lug 2025
Starting from R2016a, you can distribute your standalone MATLAB Compiler application (or MATLAB Compiler SDK library) with an installer that includes only a subset of MATLAB Runtime that is needed for the application to run. With this installer, the selective, space-efficient MATLAB Runtime will be installed together with the standalone application.
There are three ways to create an installer for your compiled MATLAB application:

Option 1: Use Compiler Apps

You can generate the installer by using the Application Compiler (or Library Compiler) app, and either select that MATLAB Runtime is downloaded from the web, or included in the package:
See: Create Standalone Application Using Application Compiler App (R2024b).
In R2025a, Compiler apps have been updated to integrate with MATLAB projects. Select the runtime delivery method in the Installer Details of your project's compiler task:
See: Create Standalone Application Using Standalone Application Compiler App
(R2025a+).

Option 2: Use the 'compiler.package.installer' function

In R2020a, the 'compiler.package.installer' function was added as a programmatic way to create an installer. See the following pages for more information on syntax and usage:
Starting in R2025a, you can use the 'compiler.package.installer' function with the OptionalDependencies option to control whether the installer includes optional run-time dependencies. This option allows you to further minimize the size of the generated installer. 
 

Option 3: Create a Docker container

Starting from R2020b, you can use 'compiler.package.docker' to encapsulate your compiled MATLAB application within a Docker® container. This method ensures the container will not contain the full MATLAB Runtime, but includes only the necessary products that your application relies on.
Note that this approach is currently supported only on Linux systems with Docker installed. This process also requires an internet connection, as MATLAB will have to download a copy of the Runtime installer and pull an Ubuntu Docker image during this process. See this documentation page:
The 'compiler.runtime.createDockerImage' function also supports the OptionalDependencies option to control whether the installer includes optional run-time dependencies in R2025a. This option allows you to further minimize the size of the generated installer.  

Alternative: Create custom MATLAB Runtime installer (R2024b+)

For creating a custom MATLAB Runtime installer that does not package an application, see the following MATLAB Answer:

Più risposte (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by