| Real-Time Workshop® | ![]() |
| On this page… |
|---|
Can I Add Files to the Embedded MATLAB Path? When to Use the Embedded MATLAB Path |
Embedded MATLAB Coder 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 Coder, 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. Because Embedded MATLAB Coder 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 of the function to the MATLAB path.
Add the Embedded MATLAB version of the function 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 emlc in the Real-Time Workshop Function Reference. |
| MATLAB path | Follow the instructions in Adding a Directory to the Search Path in the MATLAB Programming Fundamentals documentation. |
Embedded MATLAB Coder enforces naming conventions for M-functions and generated files.
Embedded MATLAB Coder 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.
The following table describes how Embedded MATLAB Coder names generated files. Embedded MATLAB Coder follows MATLAB conventions by providing platform-specific extensions for C MEX files.
| Platform | MEX File Extension | Real-Time Workshop Library Extension | Real-Time Workshop Executable Extension |
|---|---|---|---|
| Linus Torvalds' Linux (32-bit) | .mexglx | .a | None |
| Linux x86-64 | .mexa64 | .a | None |
| MicrosoftWindows (32-bit) | .mexw32 | .lib | .exe |
| Windows x64 | .mexw64 | .lib | .exe |
![]() | 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 |