| Embedded MATLAB™ | ![]() |
| On this page… |
|---|
Optimizes M-Code for Run-Time Efficiency |
Embedded MATLAB MEX is a function that optimizes M-code for run-time efficiency in the following applications:
| Application | What Embedded MATLAB MEX Does | |
|---|---|---|
| Accelerate fixed-point calculations | Converts M-code to C-MEX functions that contain Embedded MATLAB optimizations
for automatically accelerating fixed-point algorithms to compiled
C code speed.
| |
| Run M-code in Simulink | Checks M-code for compliance with Embedded MATLAB syntax
and semantics, as described in Working with the Embedded MATLAB Subset. You can add compliant code
to:
|
MEX-files are dynamically linked subroutines that the MATLAB interpreter can automatically load and execute. C-MEX files are MEX-files that are written in the C programming language, but can run directly in MATLAB. For more information, see Using MEX-Files to Call C and Fortran Programs in the MATLAB External Interfaces documentation.
Fixed-Point Toolbox software ships with a demonstration of how to generate a C-MEX function from M-code. The M-code takes the weighted average of a signal to create a lowpass filter. If you have a Fixed-Point Toolbox license, you can run the demo by following these steps:
Install Fixed-Point Toolbox.
At the MATLAB prompt, type this command:
demos
The Help browser appears, listing categories of demos in the left pane.
In the left pane, navigate to Toolboxes > Fixed-Point > Fixed-Point Lowpass Filtering Using Embedded MATLAB MEX.
Follow the instructions in the right pane of the Help browser.
Embedded MATLAB MEX resolves function calls by first searching the Embedded MATLAB path and then the MATLAB path. By default, Embedded MATLAB MEX tries to compile and generate code for functions it finds on the path unless you explicitly declare the function to be extrinsic. Embedded MATLAB does not compile extrinsic functions, but rather dispatches them to MATLAB for execution. For more information, see How the Embedded MATLAB Subset Resolves Function Calls in the Embedded MATLAB documentation.
![]() | Working with Embedded MATLAB MEX | Workflow for Converting M-Code to a C-MEX Function | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |