Products & Services Solutions Academia Support User Community Company

Generating MEX Functions Using Build Scripts

Why Use Build Scripts?

In Compiling M-Code Using emlmex, you generated a MEX function for your M-code by calling emlmex from the MATLAB command line. In this part of the tutorial, you use a build script to generate your MEX function.

 Best Practice — Using Build Scripts

 Best Practice — File Naming Convention

Contents of the Example Build Script

The build script file emldemo_lms_build_02_mex.m supplied with this tutorial contains.

close all;
clear all;
clc;

N = 73113;

emlmex emldemo_lms_02 -eg { zeros(N,1) zeros(N,1) } ...
 -report -o emldemo_lms_02_mex

where:

Using the Example Build Script

To use the build script emldemo_lms_build_02_mex.m to generate a MEX function for emldemo_lms_02.m:

  1. Set your MATLAB current folder to the folder that contains your files for this tutorial. At the MATLAB command line, enter:

    cd folder

    where folder is the full path name of the folder containing the files. See Viewing and Changing the Current Folder Using the Current Folder Browser in the MATLAB Desktop Tools and Development Environment documentation for more information.

  2. Run the build script by typing emldemo_lms_build_02_mex at the MATLAB command prompt.

    emlmex processes the build file and outputs the message:

    C-MEX generation successful: Open coder report.
  3. Verify that the output file emldemo_lms_02_mex is in the current folder.

      Note   The file extension you see depends on the platform on which you are running. MATLAB adds a platform-specific file extension to the MEX output file. for example. For example, on 32-bit Windows platforms, the output file is emldemo_lms_02_mex.mexw32. See Naming Conventions in the Embedded MATLAB User's Guide for more information.

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS