| Contents | Index |
| On this page… |
|---|
The Simulink Coder product includes a variety of approaches for integrating legacy or custom code with generated code. Legacy code is existing handwritten code or code for environments that must be integrated with code generated by the Simulink Coder software. Custom code is legacy code or any other user-specified lines of code that must be included in the Simulink Coder build process. Collectively, legacy and custom code are called external code.
There are two ways that you can achieve external code integration. You can import existing external code into code generated by code generation technology or you can export generated code into an existing external code base. For example, you might want to use generated code as a plug-in function.
Based on application goals, external code integration can be characterized as follows:
Import external code into generated code
Reuse of an algorithmic component in generated code
Deploy an application with algorithm code within the target environment
Generate target optimizations within algorithm code
Export generated code into external code
Export generated algorithm code for an embedded application
Export an algorithm executable for system simulation
Use the following flow diagram to prepare for integration and choose integration paths that best map to your application components. As the diagram shows, before you make integration decisions, assess your application architecture and partition it as much as possible. Working with smaller units makes it easier to map algorithms to modeling components and decide how to integrate the components. For each component, use the highlighted area of the flow diagram to identify the most applicable type of integration. Then, see the information provided for the corresponding type.

![]() | External Code Integration | Reuse Algorithmic Components in Generated Code | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |