compiler.runtime.customInstaller - Create a MATLAB Runtime installer for the specified files generated by MATLAB

        Compiler - MATLAB ([original](https://www.mathworks.com/help/compiler/compiler.runtime.custominstaller.html)) ([raw](?raw))

Create a MATLAB Runtime installer for the specified files generated by MATLAB Compiler

Since R2024b

Syntax

Description

compiler.runtime.customInstaller([installerName](#mw%5F15ed4e9f-c65d-444a-807b-696aafd0b0ee), [results](#mw%5F1116eb65-e67a-44ab-a389-96cd069e40b6)) creates a MATLAB® Runtime installer with a minimal size footprint that installs only the MATLAB Runtime components required to run the specified artifacts created with MATLAB Compiler™ or MATLAB Compiler SDK™. You specify the artifacts using results, which is a vector of one or more compiler.build.Results objects created by anycompiler.build function.

example

compiler.runtime.customInstaller([installerName](#mw%5F15ed4e9f-c65d-444a-807b-696aafd0b0ee), [filepath](#mw%5Ffc29e0eb-dee8-4c8a-a1b8-719c4593abbc)) creates a MATLAB Runtime installer using a list of requiredMCRProducts.txt files generated by MATLAB Compiler.

example

compiler.runtime.customInstaller(___,[Name=Value](#namevaluepairarguments)) creates a MATLAB Runtime installer with additional options specified as one or more name-value arguments. Options include the output folder, package type, and runtime delivery method.

example

Examples

collapse all

Create a minimal MATLAB Runtime installer that installs all MATLAB Runtime components required to run a standalone application.

Write a MATLAB function to package into a standalone application. For this example, compile using the filemagicsquare.m.

copyfile(fullfile(matlabroot,"extern","examples","compiler","magicsquare.m"));

Create a standalone application usingcompiler.build.standaloneApplication. Save the output from the function as a compiler.build.Results object.

results = compiler.build.standaloneApplication("magicsquare.m");

Create a MATLAB Runtime installer that contains the components required to run the standalone application.

compiler.runtime.customInstaller("magicsquareInstaller",results);

Deploy the standalone application and generated MATLAB Runtime installer on the target machine.

The installed MATLAB Runtime takes up less space than a full MATLAB Runtime installation.

Create a minimal MATLAB Runtime installer on an offline machine by using the full MATLAB Runtime installer.

Using a machine connected to the internet, download the full MATLAB Runtime installer for the offline machine's MATLAB release. For details, see Download and Install MATLAB Runtime (MATLAB Compiler SDK). Transfer the installer to the offline machine.

On the offline machine, in MATLAB, open the Preferences menu and selectMATLAB Compiler. Specify the location of the MATLAB Runtime installer.

On the offline machine, write a MATLAB function to package into a standalone application. For this example, compile using the filemagicsquare.m.

copyfile(fullfile(matlabroot,"extern","examples","compiler","magicsquare.m"));

Create a standalone application usingcompiler.build.standaloneApplication. Save the output from the function as a compiler.build.Results object.

results = compiler.build.standaloneApplication("magicsquare.m");

Create a MATLAB Runtime installer that contains the components required to run the standalone application.

compiler.runtime.customInstaller("magicsquareInstaller",results);

Deploy the standalone application and generated MATLAB Runtime installer on the target machine.

Create a MATLAB Runtime installer on Windows® using the requiredMCRProducts.txt files generated byMATLAB Compiler.

Write a MATLAB function to package into a standalone Windows application. For this example, copy the MATLAB script flames.m and data fileflames.mat to your current working directory.

copyfile(fullfile(matlabroot,"extern","examples","compiler","flames.*"));

Use mcc to create a standalone Windows application using flames.m.

mcc("flames.m","-e","-a","flames.mat","-d","flames")

Create an Excel® add-in using the file houdini.m.

copyfile(fullfile(matlabroot,"extern","examples","compiler","houdini.m")); compiler.build.excelAddIn("houdini.m","GenerateVisualBasicFile","on","OutputDir","houdini");

Create a MATLAB Runtime installer that contains the components required to run both the standalone application and the Excel add-in.

compiler.runtime.customInstaller("flames_houdiniInstaller",... ["flames\requiredMCRProducts.txt","houdini\requiredMCRProducts.txt"]);

A MATLAB Runtime installer named flames_houdiniInstaller.exe is generated in the folder flames_houdiniInstaller.

Create a MATLAB Runtime installer that installs all MATLAB Runtime components required to run multiple C++ shared libraries.

For this example, copy the matrix folder that ships with MATLAB to your work folder.

copyfile(fullfile(matlabroot,"extern","examples","compilersdk","c_cpp","matrix"),"matrix")

Navigate to the new matrix subfolder in your work folder.

Create two C++ shared libraries usingcompiler.build.cppSharedLibrary.

functionfiles = {"addmatrix.m", "multiplymatrix.m", "eigmatrix.m"};

results1 = compiler.build.cppSharedLibrary(functionfiles,... "OutputDir","matrixLibraries");

results2 = compiler.build.cppSharedLibrary("subtractmatrix.m",... "OutputDir","matrixLibraries");

Create a MATLAB Runtime installer that can be used for all libraries. Use name-value arguments to specify the build folder and embed MATLAB Runtime in the installer for offline deployment.

compiler.runtime.customInstaller("matrixInstaller",[results1,results2],... OutputDir="customInstallers",RuntimeDelivery="installer")

The installer matrixInstaller.zip is generated in thecustomInstallers folder in the current working directory.

Deploy the MATLAB Runtime installer and shared library files (.ctf and.hpp) to the target machine.

Input Arguments

collapse all

Name of the installer file, specified as a character vector or a string scalar. The extension is determined by the operating system in which the function is executed.

Example: "MagicSquare_Installer"

One or more paths to requiredMCRProducts.txt, which is generated by MATLAB Compiler or MATLAB Compiler SDK.

Example: ["fun1/requiredMCRProducts.txt","fun2/requiredMCRProducts.txt"]

Name-Value Arguments

collapse all

Specify optional pairs of arguments asName1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Example: PackageType="zip"

Since R2025a

Optional MATLAB Runtime dependencies to include in the installer, specified as one of the following:

Example: OptionalDependencies="none"

Path to the output directory where the installer is saved, specified as a character vector or a string scalar. The path can be relative to the current working directory or absolute.

The default name of the output folder is the value ofinstallerName.

Example: OutputDir="D:\Documents\MATLAB\work\myappInstaller"

Data Types: char | string

Installer file type, specified as one of the following options.

Example: PackageType="zip"

Data Types: char | string

MATLAB Runtime delivery method, specified as one of the following options.

Example: RuntimeDelivery="installer"

Data Types: char | string

Tips

Version History

Introduced in R2024b

expand all

You can use the OptionalDependencies option to control whether to include all of the optional MATLAB Runtime dependencies in the installer.