MATLAB: Is it possible to create a MATLAB Compiler-based application that is a single, self-sufficient executable file

MATLAB Compiler

I would like to statically link my MATLAB Compiler-based application against all necessary libraries, so that I can distribute a single-file application that does not need addional shared libraries.

Best Answer

The ability to build a single-file executable by statically linking all libraries is not available in MATLAB Compiler.
To work around this issue, you can use the Packaging functionality of DEPLOYTOOL to bundle the MCR along with your application files, in order to simplify installation.
Many modern applications --- including MATLAB and applications generated by the MATLAB Compiler --- are split into several modules or shared libraries or dynamically linked libraries (DLLs). This approach has several benefits over a single, monolithic file. Two of the most significant are sharing common code and maintainability.
1. When several applications use the same set of common routines --- in this case, a certain version of the MCR --- you can install one copy, instead of having duplicate copies of these routines embedded in each Compiler-based application.
2. Updates and patches can replace only the affected module, rather than the entire application. In the case of Compiler-generated applications, one patch to the MCR can benefit all applications on that computer; if the MCR was embedded in each application, you would instead have to get updated versions of each application.