The following table describes the data types that are supported by blocks in the main Simulink library. All blocks that can generate code contain an "X" in the column titled "Code Generation Support". A subset of these blocks are not recommended for production code as flagged by note N6. Guidelines to determine when a block is recommended for production code are listed below the table.
Some blocks have caveats and/or notes that should be taken into account when they are used. Caveats and notes are indicated in the table by "C#" and "N#", respectively, and are described below the table.
Simulink Library
(not including Model-Wide Utilities sublibrary)
|
|||||||
Sublibrary | Block | Double | Single | Boolean | Base Integer | Fixed-Point |
Code Generation Support
|
---|---|---|---|---|---|---|---|
Sources | Band-Limited White Noise |
X
|
X (C1)
|
||||
Chirp |
X
|
X (N6) | |||||
Clock |
X
|
X (N6) | |||||
Constant |
X
|
X
|
X
|
X
|
X
|
X
|
|
Counter Free Running |
X (C6)
|
X (C6)
|
|
X
|
X
|
X (N6) | |
Counter Limited |
X (C6)
|
X (C6)
|
X
|
X
|
X
|
X (C5)
|
|
Digital Clock |
X
|
X (N6) | |||||
From File |
X
|
(N3) |
|||||
From Workspace |
X
|
X |
X |
X |
X (C7) |
(N3) |
|
Ground |
X
|
X
|
X
|
X
|
X
|
X
|
|
Inport (In1) |
X
|
X
|
X
|
X
|
X
|
X
|
|
Pulse Generator |
X
|
|
|
|
|||
Ramp |
X
|
X (N6) | |||||
Random Number |
X
|
X
|
|||||
Repeating Sequence |
X
|
(N3) |
|||||
Repeating Sequence Interpolated |
X
|
X
|
X
|
X
|
X
|
||
Repeating Sequence Stair |
X
|
X
|
X
|
X
|
X
|
X (C5)
|
|
Signal Builder |
X
|
X (N6) | |||||
Signal Generator |
X
|
X (N6) | |||||
Sine Wave |
X
|
||||||
Step |
X
|
X (N6) | |||||
Uniform Random Number |
X
|
|
X
|
||||
Sublibrary | Block | Double | Single | Boolean | Base Integer | Fixed-Point |
Code Generation Support
|
Sinks | Display |
X
|
X
|
X
|
X
|
X
|
X (N1)
|
Floating Scope |
X
|
X
|
X
|
X
|
X
|
X (N1)
|
|
Outport (Out1) |
X
|
X
|
X
|
X
|
X
|
X
|
|
Scope |
X
|
X
|
X
|
X
|
X
|
X (N1)
|
|
Stop Simulation |
X
|
X
|
|||||
Terminator |
X
|
X
|
X
|
X
|
X
|
X
|
|
To File |
X
|
X (N6) | |||||
To Workspace |
X
|
X
|
X
|
X
|
X
|
X (N1)
|
|
XY Graph |
X
|
X |
X |
X |
X |
X (N1)
|
|
Sublibrary | Block | Double | Single | Boolean | Base Integer | Fixed-Point |
Code Generation Support
|
Continuous | Derivative |
X
|
|||||
Integrator |
X
|
||||||
State-Space |
X
|
||||||
Transfer Fcn |
X
|
||||||
Transport Delay |
X
|
||||||
Variable Transport Delay |
X
|
||||||
Zero-Pole |
X
|
||||||
Sublibrary | Block | Double | Single | Boolean | Base Integer | Fixed-Point |
Code Generation Support
|
Discrete | Discrete Filter |
X
|
|
|
|
X (N2)
|
|
Discrete State-Space |
X
|
|
|
|
X (N2)
|
||
Discrete-Time Integrator |
X
|
X
|
X
|
X
|
|||
Integer Delay |
X
|
X
|
X |
X
|
X
|
X (N2)
|
|
Discrete Tapped Delay |
X
|
X
|
X |
X
|
X
|
X (N2)
|
|
Discrete Derivative |
X
|
X
|
X
|
X
|
|||
Discrete Transfer Fcn |
X
|
X
|
|
|
X (N2)
|
||
Discrete Zero-Pole |
X
|
|
|
|
X (N2)
|
||
Difference |
X
|
X
|
|
X
|
X
|
X (C5)
|
|
Transfer Fcn Lead or Lag |
X
|
X
|
|
X
|
X
|
X (C5)
|
|
Transfer Fcn First Order |
X
|
X
|
|
X
|
X
|
X (C5)
|
|
Transfer Fcn Real Zero |
X
|
X
|
|
X
|
X
|
X (C5)
|
|
Weighted Moving Average |
X
|
X
|
X
|
X
|
X
|
X
|
|
First-Order Hold |
X
|
X (N6) | |||||
Memory |
X
|
X
|
X
|
X
|
X
|
X
|
|
Unit Delay |
X
|
X
|
X
|
X
|
X
|
X (N2)
|
|
Zero-Order Hold |
X
|
X
|
X
|
X
|
X
|
X
|
|
Sublibrary | Block | Double | Single | Boolean | Base Integer | Fixed-Point |
Code Generation Support
|
Math Operations | Abs |
X
|
X
|
X
|
X
|
X
|
|
Algebraic Constraint |
X
|
||||||
Assignment |
X
|
X
|
X
|
X
|
X
|
X (N2)
|
|
Complex to Magnitude-Angle |
X
|
X
|
X |
||||
Complex to Real-Imag |
X
|
X
|
X
|
X
|
X
|
X |
|
Dot Product | X |
X |
X |
X |
X |
X |
|
Gain |
X
|
X
|
X
|
X
|
X
|
||
Magnitude-Angle to Complex |
X
|
X
|
X |
||||
Math Function (Exponential) |
X
|
X
|
|
|
X
|
||
Math Function (log) |
X
|
X
|
|
|
X
|
||
Math Function (10^u) |
X
|
X
|
|
|
X
|
||
Math Function (log10) |
X
|
X
|
|
|
X
|
||
Math Function (magnitude^2) |
X
|
X
|
|
X
|
X |
X
|
|
Math Function (square) |
X
|
X
|
|
X
|
X |
X
|
|
Math Function (squareroot) |
X
|
X
|
|
|
X
|
||
Math Function (power) |
X
|
X
|
|
|
X
|
||
Math Function (conjugate) |
X
|
X
|
|
X
|
X |
X
|
|
Math Function (reciprocal) |
X
|
X
|
|
X (C4)
|
X (C4) |
X
|
|
Math Function (hypotenuse) |
X
|
X
|
|
|
X |
X
|
|
Math Function (reminder) |
X
|
X
|
|
X
|
X
|
||
Math Function (modulo) |
X
|
X
|
|
X
|
X
|
||
Math Function (transpose) |
X
|
X
|
X
|
X
|
X |
X
|
|
Math Function (hermitian) |
X
|
X
|
|
X
|
X |
X
|
|
Matrix Concatenation |
X
|
X
|
X
|
X
|
X
|
X (N2)
|
|
MinMax |
X
|
X
|
X
|
X |
X
|
||
MinMax Running Resettable |
X
|
X
|
X
|
X |
X
|
||
Polynomial |
X
|
X
|
X
|
||||
Weighted Sample Time Math | X |
X |
X |
X |
X |
X |
|
Bias | X |
X |
X |
X |
X |
||
Unary Minus | X |
X |
X |
X |
X |
||
Sine Wave Function | X |
X |
|||||
Product |
X
|
X
|
X
|
X
|
X (N2)
|
||
Real-Imag to Complex |
X
|
X
|
X
|
X
|
X |
||
Reshape |
X
|
X
|
X
|
X
|
X
|
X
|
|
Rounding Function |
X
|
X
|
X
|
||||
Sign |
X
|
X
|
X
|
X
|
X
|
X
|
|
Slider Gain |
X
|
X
|
X
|
X
|
X
|
||
Sum |
X
|
X
|
|
X
|
X
|
X
|
|
Trigonometric Function |
X
|
X
|
X
|
||||
Sublibrary | Block | Double | Single | Boolean | Base Integer | Fixed-Point |
Code Generation Support
|
Logic and Bit Operations | Logical Operator |
X
|
X
|
X
|
X
|
X
|
X
|
Relational Operator |
X
|
X
|
X
|
X
|
X
|
X
|
|
Interval Test |
X
|
X
|
X
|
X
|
X
|
X
|
|
Interval Test Dynamic |
X
|
X
|
X
|
X
|
X
|
X
|
|
Combinatorial Logic |
X
|
|
X
|
|
|
X
|
|
Compare To Zero |
X
|
X
|
X
|
X
|
X
|
X
|
|
Compare To Constant |
X
|
X
|
X
|
X
|
X
|
X
|
|
Bit Set |
|
|
X
|
X
|
X
|
X |
|
Bit Clear |
|
|
X
|
X
|
X
|
X |
|
Bitwise Operator |
|
|
X
|
X
|
X
|
X |
|
Shift Arithmetic |
X
|
X
|
|
X
|
X
|
X
|
|
Extract Bits |
X
|
X
|
X
|
X
|
X
|
X
|
|
Detect Increase |
X
|
X
|
X
|
X
|
X
|
X (N2)
|
|
Detect Decrease |
X
|
X
|
X
|
X
|
X
|
X (N2)
|
|
Detect Change |
X
|
X
|
X
|
X
|
X
|
X (N2)
|
|
Detect Rise Positive |
X
|
X
|
X
|
X
|
X
|
X (N2)
|
|
Detect Rise Nonnegative |
X
|
X
|
X
|
X
|
X
|
X (N2)
|
|
Detect Fall Negative |
X
|
X
|
X
|
X
|
X
|
X (N2)
|
|
Detect Fall Nonpositive |
X
|
X
|
X
|
X
|
X
|
X (N2)
|
|
Sublibrary | Block | Double | Single | Boolean | Base Integer | Fixed-Point |
Code Generation Support
|
Signal Routing | Bus Creator |
X
|
X
|
X
|
X
|
X
|
X
|
Bus Selector |
X
|
X
|
X
|
X
|
X
|
X
|
|
Bus Assignment |
X
|
X
|
X
|
X
|
X
|
X
|
|
Data Store Read |
X
|
X
|
X
|
X
|
X
|
X
|
|
Data Store Memory |
X
|
X
|
X
|
X
|
X
|
X
|
|
Index Vector |
X
|
X
|
X
|
X
|
X
|
X
|
|
Data Store Write |
X
|
X
|
X
|
X
|
X
|
X
|
|
Demux |
X
|
X
|
X
|
X
|
X
|
X
|
|
From |
X
|
X
|
X
|
X
|
X
|
X
|
|
Goto |
X
|
X
|
X
|
X
|
X
|
X
|
|
Environment Controller |
X
|
X
|
X
|
X
|
X
|
X
|
|
Goto Tag Visibility |
X
|
X
|
X
|
X
|
X
|
X
|
|
Manual Switch |
X
|
X
|
X
|
X
|
X
|
X (N6) | |
Merge |
X
|
X
|
X
|
X
|
X
|
X
|
|
Multiport Switch |
X
|
X
|
X
|
X
|
X
|
X (N2)
|
|
Mux |
X
|
X
|
X
|
X
|
X
|
X
|
|
Selector |
X
|
X
|
X
|
X
|
X
|
X
|
|
Switch |
X
|
X
|
X
|
X
|
X
|
X (N2)
|
|
Sublibrary | Block | Double | Single | Boolean | Base Integer | Fixed-Point |
Code Generation Support
|
Signal Attributes | Data Type Conversion |
X
|
X
|
X
|
X
|
X |
X
|
IC |
X
|
X (N6) |
|||||
Probe |
X
|
X
|
X
|
X
|
X
|
X
|
|
Weighted Sample Time |
X
|
X
|
X
|
X
|
X
|
X
|
|
Signal Conversion |
X
|
X
|
X
|
X
|
X
|
X
|
|
Data Type Duplicate |
X
|
X
|
X
|
X
|
X
|
X
|
|
Data Type Propagation |
X
|
X
|
X
|
X
|
X
|
X
|
|
Data Type Conversion Inherited |
X
|
X
|
X
|
X
|
X
|
X
|
|
Data Type Scaling Strip |
X
|
X
|
X
|
X
|
X
|
X
|
|
Rate Transition |
X
|
X
|
X
|
X
|
X
|
||
Signal Specification |
X
|
X
|
X
|
X
|
X
|
X
|
|
Width |
X
|
X
|
X
|
X
|
X
|
X
|
|
Sublibrary | Block | Double | Single | Boolean | Base Integer | Fixed-Point |
Code Generation Support
|
Discontinuities | Backlash |
X
|
X
|
X
|
|
X (N2)
|
|
Coulomb & Viscous Friction |
X
|
X
|
X
|
X |
X (C5)
|
||
Dead Zone |
X
|
X
|
X
|
X |
X
|
||
Dead Zone Dynamic |
X
|
X
|
|
X
|
X
|
X (C5)
|
|
Hit Crossing |
X
|
X (N6) | |||||
Quantizer |
X
|
X
|
X
|
||||
Rate Limiter |
X
|
X |
X |
X |
X (C1) |
||
Rate Limiter Dynamic |
X
|
X |
X |
X |
|||
Relay |
X
|
X
|
X
|
X
|
X
|
X
|
|
Saturation |
X
|
X
|
|
X
|
X
|
X
|
|
Saturation Dynamic |
X
|
X
|
|
X
|
X
|
X (C5)
|
|
Wrap To Zero |
X
|
X
|
X
|
X
|
X
|
X (C5)
|
|
Sublibrary | Block | Double | Single | Boolean | Base Integer | Fixed-Point |
Code Generation Support
|
Lookup Tables | Direct Lookup Table (n-D) |
X
|
X
|
X
|
X
|
X (N2)
|
|
Interpolation (n-D) using PreLookup |
X
|
X
|
X
|
||||
Lookup Table |
X
|
X
|
|
X
|
X
|
X
|
|
Lookup Table Dynamic |
X
|
X
|
X
|
X
|
X
|
X
|
|
Sine |
X
|
X
|
X
|
X
|
X
|
X (C5)
|
|
Cosine |
X
|
X
|
X
|
X
|
X
|
X (C5)
|
|
Lookup Table (2-D) |
X
|
X
|
|
X
|
X
|
X
|
|
Look-Up Table (n-D) |
X
|
X
|
X
|
||||
PreLookup Index Search |
X
|
X
|
X
|
||||
Sublibrary | Block | Double | Single | Boolean | Base Integer | Fixed-Point |
Code Generation Support
|
User-Defined Functions |
X
|
X
|
X
|
||||
X
|
(N8) | ||||||
S-Function |
X
|
X
|
X
|
X
|
X (N5) |
X (N7)
|
|
Embedded MATLAB |
X
|
X
|
X
|
X
|
X
|
||
M-File S-function |
X
|
X
|
X
|
X
|
X |
|
|
S-Function Builder |
X
|
X
|
X
|
X
|
X |
X
|
|
Sublibrary | Block | Double | Single | Boolean | Base Integer | Fixed-Point |
Code Generation Support
|
Model Verification | Assertion |
X
|
X
|
X
|
X
|
X
|
X
|
Check Discrete Gradient |
X
|
X
|
signed
|
X |
X
|
||
Check Dynamic Gap |
X
|
X
|
X
|
X
|
X |
X
|
|
Check Dynamic Lower Bound |
X
|
X
|
X
|
X
|
X |
X
|
|
Check Dynamic Range |
X
|
X
|
X
|
X
|
X |
X
|
|
Check Dynamic Upper Bound |
X
|
X
|
X
|
X
|
X |
X
|
|
Check Input Resolution |
X
|
X
|
|||||
Check Static Gap |
X
|
X
|
X
|
X
|
X |
X
|
|
Check Static Lower Bound |
X
|
X
|
X
|
X
|
X |
X
|
|
Check Static Range |
X
|
X
|
X
|
X
|
X |
X
|
|
Check Static Upper Bound |
X
|
X
|
X
|
X
|
X |
X
|
|
Sublibrary | Block | Double | Single | Boolean | Base Integer | Fixed-Point |
Code Generation Support
|
Ports & Subsystems | Atomic Subsystem |
X
|
X
|
X
|
X
|
X
|
X
|
Configurable Subsystem |
X
|
X
|
X
|
X
|
X
|
X
|
|
CodeReuseSubsystem |
X
|
X
|
X
|
X
|
X
|
X
|
|
Enabled Subsystem |
X
|
X
|
X
|
X
|
X
|
X
|
|
Enabled and Triggered Subsystem |
X
|
X
|
X
|
X
|
X
|
X
|
|
For Iterator Subsystem |
X
|
X
|
X
|
X
|
X
|
X
|
|
Model |
X
|
X
|
X
|
X
|
X
|
X
|
|
Function-Call Generator |
X
|
||||||
Function-Call Subsystem |
X
|
X
|
X
|
X
|
X
|
X
|
|
If |
X
|
X
|
X
|
X
|
X
|
||
If Action Subsystem |
X
|
X
|
X
|
X
|
X
|
X
|
|
Switch Case |
X
|
X
|
X
|
X
|
|
X
|
|
Switch Case Action Subsystem |
X
|
X
|
X
|
X
|
X
|
X
|
|
Subsystem |
X
|
X
|
X
|
X
|
X
|
X
|
|
Triggered Subsystem |
X
|
X
|
X
|
X
|
X
|
X
|
|
While Iterator Subsystem |
X
|
X
|
X
|
X
|
X
|
X
|
|
Additional Math & Discrete: | |||||||
Sublibrary | Block | Double | Single | Boolean | Base Integer | Fixed-Point |
Code Generation Support
|
Increment/Decrement | Increment Real World |
X
|
X
|
|
X
|
X
|
X (C5)
|
Decrement Real World |
X
|
X
|
|
X
|
X
|
X (C5)
|
|
Increment Stored Integer |
X
|
X
|
|
X
|
X
|
X (C5)
|
|
Decrement Stored Integer |
X
|
X
|
|
X
|
X
|
X (C5)
|
|
Decrement To Zero |
X
|
X
|
|
X
|
X
|
X (C5)
|
|
Decrement Time To Zero |
X
|
X
|
|
X
|
X
|
X
|
|
Sublibrary | Block | Double | Single | Boolean | Base Integer | Fixed-Point |
Code Generation Support
|
Additional Discrete | Transfer Fcn Direct Form II |
X
|
X
|
|
X
|
X
|
|
Transfer Fcn Direct Form II Time Varying |
X
|
X
|
|
X
|
X
|
||
Fixed-Point State-Space |
X
|
X
|
|
X
|
X
|
X (C5)
|
|
Unit Delay External IC |
X
|
X
|
X
|
X
|
X
|
||
Unit Delay Resettable |
X
|
X
|
X
|
X
|
X
|
||
Unit Delay Resettable External IC |
X
|
X
|
X
|
X
|
X
|
||
Unit Delay Enabled |
X
|
X
|
X
|
X
|
X
|
||
Unit Delay Enabled External IC |
X
|
X
|
X
|
X
|
X
|
||
Unit Delay Enabled Resettable |
X
|
X
|
X
|
X
|
X
|
||
Unit Delay Enabled Resettable External IC |
X
|
X
|
X
|
X
|
X
|
||
Unit Delay With Preview Enabled |
X
|
X
|
X
|
X
|
X
|
||
Unit Delay With Preview Enabled Resettable |
X
|
X
|
X
|
X
|
X
|
||
Unit Delay With Preview Enabled Resettable External RV |
X
|
X
|
X
|
X
|
X
|
||
Unit Delay With Preview Resettable |
X
|
X
|
X
|
X
|
X
|
||
Unit Delay With Preview Resettable External RV |
X
|
X
|
X
|
X
|
X
|
C1: Cannot be used inside a triggered subsystem hierarchy.
C2: These blocks do not reference absolute time when configured for sample-based operation. In time-based operation they depend on absolute time.
C3: Depends on absolute time when placed inside a triggered subsystem hierarchy.
C4: Currently, the reciprocal supports fixed point data types only for real inputs.
C5: The primative blocks that constitute a non-atomic masked subsystem (block) are not explicitly grouped together in the generated code. This flexibility allows for more optimal code generation. In certain cases, grouping can be achieved by configuring the masked subsystem block to execute as an atomic unit (Subsystem parameter "Treat as atomic unit").
C6: Only when the model is in the fixed-point datatype override mode.
C7: Supports input via FI objects created using the Fixed Point Toolbox.
C8: Currently, there is no support for code-generation when the input to this block is fixed-point data.
N1: Ignored for code generation.
N2: Generated code relies on memcpy or memset (string.h) under certain conditions.
N3: Consider using Repeating Sequence Stair or Repeating Sequence Interpolated for code-generation.
N4: Consider using the Model Discretizer to map these continous blocks into discrete equivalents that support code-generation. From a model, go to Tools and select Control Design. You will find the option for the Model Discretizer.
N5: See documentation for details on using Fixed-Point data types.
N6: Not recommended for production code.
N7: M-file S-functions are not supported for the real-time code generation format. S-functions that make calls into MATLAB are not supported for production code.