MATLAB Compiler


Preface

Related Products

Using this Guide

Typographical Conventions

Introducing the MATLAB Compiler

Introduction

Before You Begin

New Features

MATLAB Compiler 3.0

MATLAB Compiler 2.3

MATLAB Compiler 2.1

Compiler Licensing Changes

Uses of the Compiler

Creating MEX-Files

Creating Stand-Alone Applications

The MATLAB Compiler Family

Why Compile M-Files?

Stand-Alone Applications and Libraries

Excel Plug-Ins

COM Components

Hiding Proprietary Algorithms

Upgrading from Previous Versions of the Compiler

Upgrading from MATLAB Compiler 2.0/2.1/2.2/2.3

Upgrading from MATLAB Compiler 1.0/1.1

Limitations and Restrictions

MATLAB Code

Stand-Alone Applications

Fixing Callback Problems: Missing Functions

Installation and Configuration

System Configuration for MEX-Files

UNIX Workstation

System Requirements

Installation

mex Verification

MATLAB Compiler Verification

Microsoft Windows on PCs

System Requirements

Installation

mex Verification

MATLAB Compiler Verification

Troubleshooting

mex Troubleshooting

Troubleshooting the Compiler

Working with MEX-Files

A Simple Example -- The Sierpinski Gasket

Compiling the M-File into a MEX-File

Invoking the MEX-File

Compiler Options and Macros

Generating Simulink S-Functions

Simulink Specific Options

Specifying S-Function Characteristics

Converting Script M-Files to Function M-Files

Stand-Alone Applications

Differences Between MEX-Files
and Stand-Alone Applications

Stand-Alone C Applications

Stand-Alone C++ Applications

Building Stand-Alone C/C++ Applications

Overview

Getting Started

Building Stand-Alone Applications on UNIX

Configuring for C or C++

Preparing to Compile

Verifying mbuild

Verifying the MATLAB Compiler

About the mbuild Script

Packaging UNIX Applications

Building Stand-Alone Applications on PCs

Configuring for C or C++

Preparing to Compile

Verifying mbuild

Verifying the MATLAB Compiler

About the mbuild Script

Using an Integrated Development Environment

Packaging Windows Applications for Distribution

Distributing Stand-Alone Applications

Packaging the MATLAB Run-Time Libraries

Installing Your Application

Problem Starting Stand-Alone Application

Building Shared Libraries

Building COM Objects

Building Excel Plug-Ins

Troubleshooting

Troubleshooting mbuild

Troubleshooting the Compiler

Coding with M-Files Only

Alternative Ways of Compiling M-Files

Compiling MATLAB Provided M-Files Separately

Compiling mrank.m and rank.m as Helper Functions

Mixing M-Files and C or C++

Simple Example

Advanced C Example

Controlling Code Generation

Code Generation Overview

Example M-Files

Generated Code

Compiling Private and Method Functions

The Generated Header Files

C Header File

C++ Header File

Internal Interface Functions

C Interface Functions

C++ Interface Functions

Supported Executable Types

Generating Files

MEX-Files

Main Files

Simulink S-Functions

C Libraries

C Shared Library

C++ Libraries

COM Components

Porting Generated Code to a Different Platform

Formatting Compiler-Generated Code

Listing All Formatting Options

Setting Page Width

Setting Indentation Spacing

Including M-File Information in Compiler Output

Controlling Comments in Output Code

Controlling #line Directives in Output Code

Controlling Information in Run-Time Errors

Interfacing M-Code to C/C++ Code

C Example

Using Pragmas

Optimizing Performance

Optimization Bundles

Optimizing Arrays

Scalar Arrays

Nonscalar Arrays

Scalars

Optimizing Loops

Simple Indexing

Loop Simplification

Optimizing Conditionals

Optimizing MATLAB Arrays

Scalars

Scalar Doubles

Reference

Functions -- By Category

Pragmas

Compiler Functions

Command Line Tools

Functions -- By Name

MATLAB Compiler Quick Reference

Common Uses of the Compiler

mcc

Error and Warning Messages

Compile-Time Errors

Warning Messages

Run-Time Errors


 Preface