| Contents | Index |
| On this page… |
|---|
Distribute MATLAB Code Using the MATLAB Compiler Runtime (MCR) |
On target computers without MATLAB, install the MCR, if it is not already present on the deployment machine.
The MATLAB Compiler Runtime (MCR) is an execution engine made up of the same shared libraries MATLAB uses to enable the execution of MATLAB files on systems without an installed version of MATLAB.
The MATLAB Compiler Runtime (MCR) is now available for downloading from the Web to simplify the distribution of your applications or components created with the MATLAB® Compiler. Direct your end users to the MATLAB Compiler product page to download the MCR, as opposed to redistributing or packaging it with your applications or components.
In order to deploy a component, you can either package the MCR along with it or simply direct your end users to download it from the Web.
Before you utilize the MCR on a system without MATLAB, run the MCR Installer. Locate the installer my entering the mcrinstaller command from MATLAB.
The installer does the following:
Installs the MCR (if not already installed on the target machine)
Installs the component assembly in the folder from which the installer is run
Copies the MWArray assembly to the Global Assembly Cache (GAC), as part of installing the MCR
Since installing the MCR requires write access to the system registry, ensure you have administrator privileges to run the MCR Installer.
The version of the MCR that runs your application on the target computer must be compatible with the version of MATLAB Compiler that built the component.
Avoid installing the MCR in MATLAB installation directories.
Include the MCR in your deployment by using the Deployment Tool.
On the Package tab of the deploytool interface, click Add MCR.
Note For more information about additional options for including the MCR Installer (embedding it in your package or locating the installer on a network share), see Packaging (Optional) in the MATLAB Compiler User's Guide or in your respective Builder User's Guide. |
When you test with the MCR, keep in mind that the MCR is an instance of MATLAB. Given this, it is not possible to load the MCR into MATLAB.
For example, if you build a generic COM component with the Deployment Tool from MATLAB Builder NE, you generate a DLL.
If you then try to test the component with an application such as actxserver, which loads its process into MATLAB, you are effectively loading the MCR into MATLAB, producing an error such as this:
mwsamp.mymagic(3,[],[]) ??? Invoke Error, Dispatch Exception: Source: tmw1.Class1.1_0 Description: MCR instance is not available
Therefore, understand the behaviors of third-party processes before attempting to test them with the MCR.
If you are uncertain about the behavior of these processes, contact your developer or systems administrator.
To install the MCR, perform the following tasks on the target machines:
If you added the MCR during packaging, open the package to locate the installer. Otherwise, run the command mcrinstaller to display the locations where you can download the installer.
If you are running on a platform other than Windows, set the system paths on the target machine. Setting the paths enables your application to find the MCR.
Windows paths are set automatically. On Linux and Mac, you can use the run script to set paths. See Using MATLAB Compiler on Mac or Linux for detailed information on performing all deployment tasks specifically with UNIX variants such as Linux and Mac.
Where to find the MWArray API. The MCR also includes MWArray.dll, which contains an API for exchanging data between your applications and the MCR. You can find documentation for this API in the Help folder of the installation.
On target machines where the MCR Installer is run, the MCR Installer
puts the MWArray assembly in installation_folder\toolbox\dotnetbuilder\
bin\architecture\framework_version.
See MATLAB Builder NE Release Notes for a list of supported framework versions.
Tip Learn about creating type-safe interfaces for .NET components, in order to avoid data conversion tasks with MWArray. See Type-Safe Interfaces, WCF, and MEF for details. |
Sample Directory Structure of the MCR Including MWArray.dll

![]() | Distribute to End Users | MCR Run-Time Options | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |