| Embedded MATLAB™ | ![]() |
| On this page… |
|---|
Can I Add Files to the Embedded MATLAB Path? When to Use the Embedded MATLAB Path |
Embedded MATLAB MEX resolves M-functions by searching first on the Embedded MATLAB path and then on the MATLAB path. See How the Embedded MATLAB Subset Resolves Function Calls in the Embedded MATLAB documentation.
With Embedded MATLAB MEX, you can prepend directories and files to the Embedded MATLAB path, as described in Adding Directories to Search Paths. By default, the Embedded MATLAB path contains the current directory and the Embedded MATLAB libraries.
Use the Embedded MATLAB path to override a MATLAB function with a customized version. Since Embedded MATLAB MEX searches the Embedded MATLAB path first, an M-file on the Embedded MATLAB path always shadows an M-file of the same name on the MATLAB path. To override a MATLAB function with a version implemented in Embedded MATLAB libraries, follow these steps:
Create each version of the M-function in identically-named M-files.
Add the MATLAB version to the MATLAB path.
Add the Embedded MATLAB version to the Embedded MATLAB path.
The following table explains how to add directories to search paths:
| To add directories to: | Do this: |
|---|---|
| Embedded MATLAB path | Prepend directories to the Embedded MATLAB path using the compiler option -I. See -I Add Directories to Embedded MATLAB Path using emlmex. |
| MATLAB path | Follow the instructions in Adding a Directory to the Search Path in the MATLAB Programming documentation. |
Embedded MATLAB MEX enforces naming conventions for M-functions and generated files.
The Embedded MATLAB subset reserves the prefix eml for global C functions and variables in generated code. For example, Embedded MATLAB runtime library function names all begin with the prefix emlrt, such as emlrtCallMATLAB. To avoid naming conflicts, do not name C functions or primary M-functions with the prefix eml.
Embedded MATLAB MEX follows MATLAB conventions by providing platform-specific extensions for C-MEX files.
| Platform | MEX File Extension |
|---|---|
| Linux® (32-bit) | .mexglx |
| Linux x86-64 | .mexa64 |
| Windows (32-bit) | .mexw32 |
| Windows x64 | .mexw64 |
![]() | Setting Up the C Compiler | Making M-Code Compliant with the Embedded MATLAB Subset | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |