Main Content

Combine signal/state structures

R2026b

Whether to combine global block signal and state data into one structure

Model Configuration Pane: Code Generation / Interface

Description

The Combine signal/state structures parameter specifies whether the code generator combines global block signal and state data into one data structure.

Settings

On (default) | Off
On

Enables generation of global block signal data (block I/O) and global state data (DWork vectors) into one data structure.

Off

Disables generation of global block signal and state data into one data structure. The code generator produces separate data structures for global block signals and global states.

Examples

expand all

  1. When the Combine signal/state structures parameter is selected, generated code for block signals and states looks like this:

    /* Block signals and states (auto storage)
       for system */
    typedef struct {
      struct {
        uint_T LogicalOperator:1;
        uint_T UnitDelay1:1;
        uint_T UnitDelay_DSTATE:1;
        uint_T UnitDelay1_DSTATE:1;
      } bitsForTID0;
    } D_Work;
  2. If you clear the parameter, the code generator produces this code:

    /* Block signals (auto storage) */
    typedef struct {
      struct {
        uint_T LogicalOperator:1;
        uint_T UnitDelay1:1;
      } bitsForTID0;
    } BlockIO;
    /* Block states (auto storage) */
    typedef struct {
      struct {
        uint_T UnitDelay_DSTATE:1
        uint_T UnitDelay1_DSTATE:1
      } bitsForTID0;
    } D_Work;

Tips

When the parameter is selected, the code generator optimizes memory usage.

  • Enables tighter memory representation by using fewer bitfields, which reduces RAM usage.

  • Enables better alignment of data structure elements, which reduces RAM usage.

  • Reduces the number of arguments to reusable subsystem and Model block functions, which reduces stack usage.

  • Makes data structures more readable with more consistent element sorting.

Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyOn
Safety precautionNo impact

Programmatic Use

Parameter: CombineSignalStateStructs
Type: character vector
Value: 'on' | 'off'
Default: 'on'

Version History

Introduced in R2011a