Create an installer for files generated by MATLAB Compiler
compiler.package.installer( creates an
installer using the results)compiler.build.Results object results generated from a
compiler.build function.
compiler.package.installer(
creates an installer using the results,Name,Value)compiler.build.Results object
results with additional options specified using one or more
name-value arguments.
compiler.package.installer(
creates an installer for files generated by the files,filePath,'ApplicationName',appName,Name,Value)mcc command. The
installed application's name is specified by appName. The installer can
be customized using optional name-value arguments.
Create an installer for a standalone application using the results
from the compiler.build.standaloneApplication function.
In MATLAB®, locate the MATLAB code that you want to deploy as a standalone application. For this
example, compile using the file magicsquare.m located in
.matlabroot\extern\examples\compiler
appFile = fullfile(matlabroot,'extern','examples','compiler','magicsquare.m');
Build a standalone application using the
compiler.build.standaloneApplication command.
results = compiler.build.standaloneApplication(appFile);
Create an installer for the standalone application using the
compiler.package.installer
function.
compiler.package.installer(results);
MyAppInstaller within a folder
named magicsquareinstaller.Create an installer for a standalone application using the results
from the compiler.build.standaloneApplication function and customize it using
name-value arguments.
In MATLAB, locate the MATLAB code that you want to deploy as a standalone application. For this
example, compile using the file magicsquare.m located in
.matlabroot\extern\examples\compiler
appFile = fullfile(matlabroot,'extern','examples','compiler','magicsquare.m');
Build a standalone application using the
compiler.build.standaloneApplication command.
results = compiler.build.standaloneApplication(appFile);
Create an installer for the standalone application using the
compiler.package.installer function. Use name-value arguments to
specify the installer name and include MATLAB Runtime within the
installer.
compiler.package.installer(results,... 'InstallerName','MyMagicInstaller',... 'RuntimeDelivery','installer');
MyMagicInstaller within a
folder named magicsquareinstaller.Create an installer for a standalone application on a Windows® system using the results from the compiler.build.standaloneApplication function. Customize the installer using
an InstallerOptions object.
In MATLAB, locate the MATLAB code that you want to deploy as a standalone application. For this
example, compile using the file magicsquare.m located in
.matlabroot\extern\examples\compiler
appFile = fullfile(matlabroot,'extern','examples','compiler','magicsquare.m');
Build a standalone application using the
compiler.build.standaloneApplication command.
results = compiler.build.standaloneApplication(appFile);
Create an InstallerOptions object. Use name-value arguments to
specify the application name, author company, author name, installer name, and
summary.
opts = compiler.package.InstallerOptions('ApplicationName','MagicSquare_Generator',... 'AuthorCompany','Boston Common',... 'AuthorName','Frog',... 'InstallerName','MagicSquare_Installer',... 'Summary','Generates a magic square.')
opts =
InstallerOptions with properties:
RuntimeDelivery: 'web'
InstallerSplash: 'C:\Program Files\MATLAB\R2021a\toolbox\toolbox\compiler\resources\default_splash.png'
InstallerIcon: 'C:\Program Files\MATLAB\R2021a\toolbox\compiler\resources\default_icon_48.png'
InstallerLogo: 'C:\Program Files\MATLAB\R2021a\toolbox\compiler\resources\default_logo.png'
AuthorName: 'Frog'
AuthorEmail: ''
AuthorCompany: 'Boston Common'
Summary: 'Generates a magic square.'
Description: ''
InstallationNotes: ''
Shortcut: ''
Version: '1.0'
InstallerName: 'MagicSquare_Installer'
ApplicationName: 'MagicSquare_Generator'
OutputDir: '.\MagicSquare_Generatorinstaller'
DefaultInstallationDir: 'C:\Program Files\MagicSquare_Generator'Create an installer for the standalone application using the
Results and InstallerOptions objects as inputs to
the compiler.package.installer function.
compiler.package.installer(results,'Options',opts);MagicSquare_Installer within a
folder named MagicSquare_Generatorinstaller.Create an installer for a standalone application on a Windows system.
Write a MATLAB function that generates a magic square. Save the function in a file named
mymagic.m.
function out = mymagic(in)
out = magic(in)Build a standalone application using the mcc command.
mcc -m mymagic.m
mymagic.exe mccExcludedFiles.log readme.txt requiredMCRProducts.txt
Create an installer for the standalone application using the
compiler.package.installer
function.
compiler.package.installer(... 'mymagic.exe','D:\Documents\MATLAB\work\MagicSquare\requiredMCRProducts.txt',... 'ApplicationName','MagicSquare_Generator')
MyAppInstaller.exe within a folder named
MagicSquare_Generatorinstaller.Customize an installer for a standalone application on a Windows system using name-value arguments.
compiler.package.installer('mymagic.exe','requiredMCRProducts.txt',... 'ApplicationName','MagicSquare_Generator',... 'AuthorCompany','Boston Common',... 'AuthorName','Frog',... 'InstallerName','MagicSquare_Installer',... 'Summary','Generates a magic square.')
Customize an installer for a standalone application on a Windows system using an InstallerOptions object.
Create an InstallerOptions object.
opts = compiler.package.InstallerOptions('ApplicationName','MagicSquare_Generator',... 'AuthorCompany','Boston Common',... 'AuthorName','Frog',... 'InstallerName','MagicSquare_Installer',... 'Summary','Generates a magic square.')
opts =
InstallerOptions with properties:
RuntimeDelivery: 'web'
InstallerSplash: 'C:\Program Files\MATLAB\R2021a\toolbox\toolbox\compiler\resources\default_splash.png'
InstallerIcon: 'C:\Program Files\MATLAB\R2021a\toolbox\compiler\resources\default_icon_48.png'
InstallerLogo: 'C:\Program Files\MATLAB\R2021a\toolbox\compiler\resources\default_logo.png'
AuthorName: 'Frog'
AuthorEmail: ''
AuthorCompany: 'Boston Common'
Summary: 'Generates a magic square.'
Description: ''
InstallationNotes: ''
Shortcut: ''
Version: '1.0'
InstallerName: 'MagicSquare_Installer'
ApplicationName: 'MagicSquare_Generator'
OutputDir: '.\MagicSquare_Generator'
DefaultInstallationDir: 'C:\Program Files\MagicSquare_Generator'Pass the InstallerOptions object as an input to the
function.
compiler.package.installer('mymagic.exe','requiredMCRProducts.txt','Options',opts)
results — Build results objectResults objectBuild results, specified as a compiler.build.Results object. Create the Results object by
saving the output from a compiler.build function.
files — List of files and folders for installationList of files and folders for installation, specified as a character vector, a
string scalar, a cell array of character vectors, or a string array. These files are
typically generated by the mcc command or a
compiler.build function and can also include any additional files
and folders required by the installed application to run.
Files generated in a particular release can be packaged using the
compiler.package.installer function of the same
release.
Files of type .ctf on one operating system can be packaged
using the compiler.package.installer function on a different
operating system, as long as the build command and the
compiler.package.installer function are from the same
release.
Example: 'mymagic.exe'
Data Types: char | string
filePath — Path to requiredMCRProducts.txt filePath to the requiredMCRProducts.txt file generated by MATLAB
Compiler™.
Example: 'D:\Documents\MATLAB\work\MagicSquare\requiredMCRProducts.txt'
Data Types: char | string
appName — Name of the installed applicationName of the installed application, specified as a character vector or a string scalar.
Example: 'MagicSquare_Generator'
Data Types: char | string
opts — Installer options objectInstallerOptions objectInstaller options, specified as an InstallerOptions
object.
Specify optional
comma-separated pairs of Name,Value arguments. Name is
the argument name and Value is the corresponding value.
Name must appear inside quotes. You can specify several name and value
pair arguments in any order as
Name1,Value1,...,NameN,ValueN.
'Version','9.5' specifies the version of the installed
application.'ApplicationName' — Application name'' (default) | character vector | string scalarName of installed application, specified as a character vector or a string scalar.
Example: 'MagicSquare_Generator'
Data Types: char | string
'AuthorCompany' — Company name'' (default) | character vector | string scalarName of company that created the application, specified as a character vector or a string scalar.
Example: 'Boston Common'
Data Types: char | string
'AuthorEmail' — Email address'' (default) | character vector | string scalarEmail address of the application author, specified as a character vector or a string scalar.
Example: 'frog@bostoncommon.com'
Data Types: char | string
'AuthorName' — Name'' (default) | character vector | string scalarName of application author, specified as a character vector or a string scalar.
Example: 'Frog'
Data Types: char | string
'DefaultInstallationDir' — Default installation pathDefault directory where you want the installer to install the application, specified as a character vector or a string scalar.
If no path is specified, the default path for each operating system is:
| Operating System | Default Installation Directory |
|---|---|
| Windows | C:\Program
Files\ |
| Linux® | /usr/ |
| macOS | /Applications/ |
Example: On Windows: C:\Program Files\MagicSquare_Generator
Data Types: char | string
'Description' — Detailed application description'' (default) | character vector | string scalarDetailed description of the application, specified as a character vector or a string scalar.
Example: 'The MagicSquare_Generator application generates an n-by-n matrix constructed
from the integers 1 through n2 with equal row and column
sums.'
Data Types: char | string
'InstallationNotes' — Notes'' (default) | character vector | string scalarNotes about additional requirements for using application, specified as a character vector or a string scalar.
Example: 'This is a Linux installer.'
Data Types: char | string
'InstallerIcon' — Path to icon imagePath to an image file used as the icon for the installed application, specified as a character vector or a string scalar.
The default path is:
'matlabroot\toolbox\compiler\resources\default_icon_48.png'Example: 'D:\Documents\MATLAB\work\images\myIcon.png'
'InstallerLogo' — Path to installer imagePath to an image file used as the installer's logo, specified as a character vector or a string scalar. The logo will be resized to 150 pixels by 340 pixels.
The default path is:
'matlabroot\toolbox\compiler\resources\default_logo.png'Example: 'D:\Documents\MATLAB\work\images\myLogo.png'
'InstallerName' — Name of installer fileMyAppInstaller (default) | character vector | string scalarName 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'
'InstallerSplash' — Path to splash screen imagePath to an image file used as the installer's splash screen, specified as a character vector or a string scalar. The splash screen icon will be resized to 400 pixels by 400 pixels.
The default path is:
'matlabroot\toolbox\toolbox\compiler\resources\default_splash.png'Example: 'D:\Documents\MATLAB\work\images\mySplash.png'
'OutputDir' — Path to folder where the installer will be savedPath to folder where the installer is saved, specified as a character vector or a string scalar.
If no path is specified, the default path for each operating system is:
| Operating System | Default Installation Directory |
|---|---|
| Windows | .\ |
| Linux | ./ |
| macOS | ./ |
The . in the directories listed above
represents the present working directory.
Example: 'D:\Documents\MATLAB\work\MagicSquare'
'RuntimeDelivery' — MATLAB Runtime delivery option'web' (default) | 'installer'Choice on how the MATLAB Runtime is made available to the installed application.
'web'—Option for installer to download
MATLAB Runtime from MathWorks® website during application installation. This is the
default option.
'installer'—Option to include MATLAB Runtime within the installer so that it can be installed
during application installation without connecting to the
MathWorks website. Use this option if you think your end-user
may not have access to the Internet.
Example: 'installer'
Data Types: char | string
'Shortcut' — Path to shortcut'' (default) | character vector | string scalarPath to a file or folder that the installer will create a shortcut to at install time, specified as a character vector or a string scalar.
Example: '.\mymagic.exe'
Data Types: char | string
'Summary' — Summary description of application'' (default) | character vector | string scalarSummary description of the application, specified as a character vector or a string scalar.
Example: 'Generates a magic square.'
Data Types: char | string
'Version' — Version of installed application'1.0' (default) | character vector | string scalarVersion number of the installed application, specified as a character vector or a string scalar.
Example: '2.0'
Data Types: char | string