Compile Deployable Archives from Command Line

You can compile deployable archives from both the MATLAB® command line and the system terminal command line:

  • deploytool invokes one of the compiler apps to execute a presaved compiler project

  • mcc invokes the command line compiler

Execute Compiler Projects with deploytool

The deploytool command has two flags to invoke one of the compiler apps without opening a window.

  • -build project_name — Invoke the correct compiler app to build the project and not generate an installer.

  • -package project_name — Invoke the correct compiler app to build the project and generate an installer.

For example, deploytool -package magicsquare generates the binary files defined by the magicsquare project and packages them into an installer that you can distribute to others.

Compile a Deployable Archive with mcc

The mcc command invokes the raw compiler and provides fine-level control over the compilation of the deployable archive. It, however, cannot package the results in an installer.

To invoke the compiler to generate a deployable archive use the -W CTF:component_name flag with mcc. The -W CTF:component_name flag creates a deployable archive called component_name.ctf.

For compiling deployable archives, you can also use the following options.

Compiler Options

OptionDescription
-a filePathAdd any files on the path to the generated binary.
-d outFolderSpecify the folder into which the results of compilation are written.
class{className:mfilename...}Specify that an additional class is generated that includes methods for the listed MATLAB files.

Was this topic helpful?