Jump to content

MATLAB Programming/Advanced Topics/Toolboxes and Extensions/MATLAB Compiler

From Wikibooks, open books for an open world

Overview

[edit | edit source]

Use the MATLAB Compiler to convert MATLAB programs to applications and libraries that you can distribute to end users who do not have MATLAB installed. You can compile M-files, MEX-files, or other MATLAB code. MATLAB Compiler supports all the features of MATLAB, including objects, private functions, and methods. Using MATLAB Compiler version before 3 you can generate

  • Standalone C and C++ applications on UNIX, Windows, and Macintosh platforms.
  • C and C++ shared libraries (dynamically linked libraries, or DLLs, on Microsoft Windows).

MATLAB Compiler version 4 no longer provides these capabilities on Windows and Linux and you can generate

  • Standalone application on Linux and Windows based on Java/JIT methods
  • Shared libraries on Linux and DLLs on Microsoft Windows

How to Use

[edit | edit source]

Known Problems

[edit | edit source]

Matlab Compiler version 4.1, distributed with Matlab 7 (R14SP1) for Solaris has a bug in the buildmcr function. This can be fixed by following these instructions:

  • Quit MATLAB.
  • Rename the following M-file:
  $MATLAB\toolbox\compiler\buildmcr.m
  (where $MATLAB is the MATLAB root directory on your machine, as returned by typing
  matlabroot
  at the MATLAB command prompt.)

Rename the file to buildmcr.m.old

If for some reason you can't get the se files, get this fixed version of Buildmcr.m and this fixed version of ctfcreatezip.mexsol available as text and uuencoded text, respectively.

Place the new files in $MATLAB\toolbox\compiler.

  • Restart MATLAB.