| Contents | Index |
| On this page… |
|---|
Steps by the Developer to Deploy to End Users What Software Does the End User Need? Using Relative Paths with Project Files Porting Generated Code to a Different Platform |
For an end user to run an application or use a library that contains compiled MATLAB code, there are two sets of tasks. Some tasks are for the developer who developed the application or library, and some tasks are for the end user.
Create a package that contains the software needed at run time. See What Software Does a Developer Need? for more details.
Note The package for end users must include the .ctf file, which includes all the files in your preferences folder. Be aware of the following with regards to preferences:
. The preferences folder is as follows:
The folder will be stored in the CTF archive in a folder with a generated name, such as: mwapplication_mcr/myapplication_7CBEDC3E1DB3D462C18914C13CBFA649. |
Write instructions for the end user. See Steps by the End User.
Distribute the package to your end user, along with the instructions.
Steps by the End User
Open the package containing the software needed at run time.
Run MCRInstaller once on the target machine, that is, the machine where you want to run the application or library. The MCRInstaller opens a command window and begins preparation for the installation. See Using the MCR Installer GUI.
If you are deploying a Java application to end users, they must set the class path on the target machine.
Note for Windows Applications You must have administrative privileges to install the MCR on a target machine since it modifies both the system registry and the system path. Running the MCRInstaller after the MCR has been set up on the target machine requires only user-level privileges. |
Using the MCR Installer GUI
When the MCR Installer wizard appears, click Next to begin the installation. Click Next to continue.
In the Select Installation Folder dialog box, specify where you want to install the MCR and whether you want to install the MCR for just yourself or others. Click Next to continue.
Confirm your selections by clicking Next.
The installation begins. The process takes some time due to the quantity of files that are installed.
The MCR Installer automatically:
Copies the necessary files to the target folder you specified.
Registers the components as needed.
Updates the system path to point to the MCR binary folder, which is <target_directory>/<version>/runtime/win32|win64.
When the installation completes, click Close on the Installation Completed dialog box to exit.
The software required by end users depends on which of the following kinds of software is to be run by the user:
To distribute a shared library created with MATLAB Compiler to end users, create a package that includes the following files.
Component | Description |
|---|---|
MCR Installer | Self-extracting MATLAB Compiler Runtime library utility; platform-dependent file that must correspond to the end user's platform. |
| matrixdriver.exe (Windows) matrixdriver (UNIX) | Application |
libmatrix | Shared library; extension varies by platform. Extensions are:
|
To distribute a .NET application that uses components created with MATLAB Builder NE, create a package that includes the following files.
| Software Module | Description |
|---|---|
| componentName.xml | Documentation files |
| componentName.pdb (if Debug option is selected) | Program Database File, which contains debugging information |
| componentName.dll | Component assembly file |
| MCR Installer | MCR Installer (if not already installed on the target machine). Run mcrinstaller function to obtain name of executable. |
| application.exe | Application |
To distribute a COM application that uses components created with MATLAB Builder NE or MATLAB Builder EX, create a package that includes the following files.
| Software Module | Description |
|---|---|
| componentname.ctf | Component Technology File (ctf) archive. This is a platform-dependent file that must correspond to the end user's platform. |
| componentname _version.dll | Component that contains compiled MATLAB code |
| _install.bat | Script run by the self-extracting executable |
| MCR Installer | Self-extracting MATLAB Compiler Runtime library utility; platform-dependent file that must correspond to the end user's platform. The MCR Installer installs MATLAB Compiler Runtime (MCR), which users of your component need to install on the target machine once per release. Run mcrinstaller function to obtain name of executable. |
| application.exe | Application |
To distribute a Java application created with MATLAB Builder JA, create a componentname.jar file. To deploy the application on computers without MATLAB, you must include the MCR when creating your Java component.
To distribute an Excel add-in created with MATLAB Builder EX, create a package that includes the following files.
| Software Module | Description |
|---|---|
| componentname _version.dll | Component that contains compiled MATLAB code |
| _install.bat | Script run by the self-extracting executable |
| MCR Installer | Self-extracting MATLAB Compiler Runtime library utility; platform-dependent file that must correspond to the end user's platform. Run mcrinstaller function to obtain name of executable. |
| *.xla | Any Excel add-in files found in projectdirectory\distrib |
Project files now support the use of relative paths as of R2007b of MATLAB Compiler, enabling you to share a single project file for convenient deployment over the network. Simply share your project folder and use relative paths to define your project location to your distributed computers.
You can distribute an application generated by MATLAB Compiler to any target machine that has the same operating system as the machine on which the application was compiled. For example, if you want to deploy an application to a Windows machine, you must use the Windows version of MATLAB Compiler to build the application on a Windows machine.
Note Since binary formats are different on each platform, the components generated by MATLAB Compiler cannot be moved from platform to platform as is. |
To deploy an application to a machine with an operating system different from the machine used to develop the application, you must rebuild the application on the desired targeted platform. For example, if you want to deploy a previous application developed on a Windows machine to a Linux machine, you must use MATLAB Compiler on a Linux machine and completely rebuild the application. You must have a valid MATLAB Compiler license on both platforms to do this.
CTF archives contain content (MATLAB files and MEX-files) that need to be extracted from the archive before they can be executed. In order to extract the archive you must override the default CTF embedding option (see MCR Component Cache and CTF Archive Embedding). To do this, ensure that you compile your component with the -C Do Not Embed CTF Archive by Default option.
The CTF archive automatically expands the first time you run a MATLAB Compiler-based component (a MATLAB Compiler based standalone application or an application that calls a MATLAB Compiler-based shared library, COM, or .NET component).
To expand an archive without running the application, you can use the extractCTF (.exe on Windows) standalone utility provided in the matlabroot/toolbox/compiler/deploy/arch folder, where arch is your system architecture, Windows = win32|win64, Linux = glnx86, x86-64 = glnxa64, and Mac OS X = mac. This utility takes the CTF archive as input and expands it into the folder in which it resides. For example, this command expands hello.ctf into the folder where it resides:
extractCTF hello.ctf
The archive expands into a folder called hello_mcr. In general, the name of the folder containing the expanded archive is <componentname>_mcr, where componentname is the name of the CTF archive without the extension.
Note To run extractCTF from any folder, you must add matlabroot/toolbox/compiler/deploy/arch to your PATH environment variable. Run extractCTF.exe from a system prompt. If you run it from MATLAB, be sure to use the bang (!) operator. |
If you are having trouble obtaining memory for your deployed application, use MATLAB Memory Shielding for deployed applications to ensure a maximum amount of contiguous allocated memory. See Reserving Memory for Deployed Applications with MATLAB Memory Shielding for more information.
![]() | Deploying to Developers | Working with the MCR | ![]() |

Learn how to build standalone executables and C/C++ shared libraries from MATLAB code.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |