Products & Services Solutions Academia Support User Community Company

Learn more about Real-Time Workshop   

Custom Code Library

The Custom Code library contains blocks that enable you to insert your own C or C++ code into specific functions within code generated by the Real-Time Workshop product for root models and subsystems. These blocks are a superset of code customization capabilities built into the Custom Code Configuration Parameters dialog box, and provide greater flexibility in terms of code placement than the controls on the dialog box.

The Custom Code library is part of the Real-Time Workshop library. You can access the Real-Time Workshop library by using the Simulink Library Browser. You can access Custom Code blocks by using the Real-Time Workshop library or by entering the MATLAB command rtwlib and then double-clicking the Custom Code Library block within it. Alternatively, you can enter the command custcode.

This chapter discusses use of the Custom Code library only.

All Custom Code blocks except for Model Header and Model Source can be dragged into either root models or atomic subsystems. Model Header and Model Source blocks can only be placed in root models.

The Custom Code library contains ten blocks that insert custom code into the generated model files and functions. You can view the blocks either by

The latter method opens the window shown in the previous section.

The two blocks on the top row contain text fields for inserting custom code at the top and bottom of

Each block contains two fields, in which you type or paste code and comments:

The next figure shows the Model Source block dialog box.

The eight function blocks in the second and third rows contain text fields to insert custom code sections at the top and bottom of these designated model functions:

Each of these blocks provides a System Outputs Function Custom Code dialog box that contains three fields:

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

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