If
Select subsystem execution using logic similar to if-else
statement
Libraries:
Simulink /
Ports & Subsystems
Description
The If block, along with If Action Subsystem blocks that contain an Action Port block, implements if-else logic to control subsystem execution. For an example that uses the If block, see Select Subsystem Execution.
Examples
Limitations
The If block has the following limitations:
It does not support tunable parameters. Values for an
if
orelseif
expression cannot be tuned during a simulation in normal or accelerator mode, or when running generated code.To implement tunable if-else expressions, tune the expression outside the If block. For example, use the Relational Operator block to evaluate the expression outside of the If block or add the tunable parameter as an input to the If block.
It does not support custom storage classes. See Organize Parameter Data into a Structure by Using Struct Storage Class (Embedded Coder).
The If expression and Elseif expressions cannot accept certain operators, such as
+
,-
,*
, and/
.
Ports
Input
Output
Parameters
Block Characteristics
Data Types |
|
Direct Feedthrough |
|
Multidimensional Signals |
|
Variable-Size Signals |
|
Zero-Crossing Detection |
|
Extended Capabilities
Version History
Introduced before R2006a