Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Reusable Code Interface

The Reusable function setting of the model configuration parameter Code interface packaging allows generated code to receive model data by function arguments. The generated code is reentrant. By default, Reusable function is not selected. Global data structures communicate model data to the generated code and access data with direct memory access. The generated code is not reentrant.

With Embedded Coder®, you determine whether the generated code passes root-level input and output as individual arguments, as structure references, or as part of the real-time model data structure. You can control whether the generated code allocates memory for model data statically or dynamically (using malloc).

open_system('rtwdemo_reusable');

To select the Reusable function from the Code interface packaging options:

  1. From the Simulink Editor, select Simulation > Model Configuration Parameters

  2. Select the Code Generation > Interface pane.

  3. Select the Reusable function from the Code interface packaging options.

  4. Configure the Multi-instance code error diagnostic option.

  5. Configure the Pass root-level I/O as option (Embedded Coder only).

  6. On the All Parameters tab, select Use dynamic memory allocation for model initialization.

bdclose('rtwdemo_reusable');
Was this topic helpful?