For R2020a and later releases:
Since MATLAB R2020a, you can create an application installer for the files generated by MATLAB Compiler with the 'compiler.package.installer' function:
There are two approaches to using 'compiler.package.installer':
OPTION 1: Use compiler.package.installer with compiler.build functions (R2020b+)
The recommended approach is to use 'compiler.package.installer' together with the new 'compiler.build' functions (available in R2020b and later). The full workflow is documented on the following page:
To include the MATLAB Runtime in the package, run the 'compiler.package.installer' command with the 'RuntimeDelivery' name-value pair set to 'installer'. See an example as follows:
>> buildResults = compiler.build.standaloneApplication(appFile);
>> compiler.package.installer(buildResults, 'RuntimeDelivery', 'installer');
To download MATLAB Runtime from the web, run the 'compiler.package.installer' command with the 'RuntimeDelivery' name-value pair set to 'web'. See an example as follows:
>> buildResults = compiler.build.standaloneApplication(appFile);
>> compiler.package.installer(buildResults, 'RuntimeDelivery', 'web');
.
OPTION 2: Use compiler.package.installer with mcc (R2020a+)
Creating an application installer for files generated by the 'mcc' command requires a different syntax. Instead of passing a buildResults object, you need to point 'compiler.package.installer' to the locations of generated files. Refer to the examples in the 'compiler.package.installer' documentation for guidance. When migrating your existing application deployment project (.prj), if you still have access to the "PackagingLog.html" file, you can see the "mcc" command used by the deployment app to create the application at the top of that file.
For R2019b and prior releases:
In R2019b and prior, there is a 'deploytool' command-line tool in addition to the application deployment GUIs. Use the "-package" option to create an installer for an existing application deployment project (.prj) without the need to open the GUI:
deploytool -package myproject.prj
For more information, access the 'deploytool' documentation from MATLAB R2019b and prior: