- To generate Standalone Executables
*Can execute without MATLAB*

The executable can run on specific type of machines for which it is compiled (*e.g.,*Windows, Linux) — even if the target machine does not have MATLAB installed.*Needs no MATLAB license*

Even on machines with MATLAB installed, running a standalone requires NO MATLAB licenses. On systems with more users than available licenses, running job with a standalone executable is most convenient and effective as there is no wait for a license to become available.- The situation will be further exacerbated if you plan to run multiple instances of matlab in a cluster environment. In this case, you would be checking out multiple MATLAB licenses — one license per instance of MATLAB.

*Protects source code*

Since the executable is in binary form, the source code is not revealed and hence may be attractive for some code developers from a proprietary standpoint.*Improves computational performance*

In the MATLAB environment, m-files are executed in interpreted mode. While this mode is desirable for interactive environment, it usually carry a speed performance penalty compared with a pre-compiled C code. For long-running production codes, interactivity is generally not pervasive while computational performance is highly desirable. The MATLAB compiler converts m-files into C codes which are then compiled to produce an executable. Often, the executable yields significant speedup in runtime compared with running it in interpreted mode.

- To Generate MEX gateway function

Users with code modules (*e.g.,*functions) that are computationally intensive may see significant speedup in runtime if these functions can be made to run in a pre-compiled mode. On the other hand, these users may still prefer to retain the interactive feature of the MATLAB environment for on-the-fly computation or graphical rendering after the compute-intensive functions are called. To enable the m-file to call an external C or fortran file, an interface is necessary. In MATLAB, this is called a gateway function. The gateway function must conform to certain requirement and you can write this gateway function in C or fortran that reflect your specific applications.

An example that apply this method to compute the solutions of an algebraic linear system of equations (via LU) in parallel was given here. Note that while the example is given for a parallel solve, it is applicable to serial processing as well.

See MATLAB Compiler User's Guide