Simulink Reference Previous page   Next Page
Switch

Switch output between the first input and the third input based on the value of the second input

Library

Simulink Signal Routing and Fixed-Point Blockset Select

Description

The Switch block passes through the first (top) input or the third (bottom) input based on the value of the second (middle) input. The first and third inputs are called data inputs. The second input is called the control input.

You select the conditions under which the first input is passed with the Criteria for passing first input parameter. You can make the block check whether the control input is greater than or equal to the threshold value, purely greater than the threshold value, or nonzero. If the control input meets the condition set in the Criteria for passing first input parameter, then the first input is passed. Otherwise, the third input is passed.

When the Show additional parameters check box is selected, some of the parameters that become visible are common to many blocks. For a detailed description of these parameters, refer to Block Parameters in the Fixed-Point Blockset documentation.

Data Type Support

The data and control inputs of a Switch block accept real or complex signals of any data type supported by Simulink, as well as fixed-point data types.

For a discussion on the data types supported by Simulink, refer to Data Types Supported by Simulink in the Using Simulink documentation.

Parameters and Dialog Box

Criteria for passing first input
Select the conditions under which the first input is passed. You can make the block check whether the control input is greater than or equal to the threshold value, purely greater than the threshold value, or nonzero. If the control input meets the condition set in this parameter, then the first input is passed. Otherwise, the third input is passed.
Threshold
Assign the switch threshold that determines which input is passed to the output.
Show additional parameters
If selected, additional parameters specific to implementation of the block become visible as shown.

Require all data port inputs to have same data type
Select to require all data inputs to have the same data type.
Output data type mode
Choose to inherit the output data type and scaling by backpropagation or by an internal rule. The internal rule causes the output of the block to have the same data type and scaling as the input with the larger positive range.
Round integer calculations toward
Select the rounding mode for fixed-point output.
Saturate on integer overflow
If selected, overflows saturate.
Enable zero crossing detection
Select to enable zero crossing detection. For more information, see Zero Crossing Detection in the Using Simulink documentation.

Characteristics

Dimensionalized
Yes
Direct Feedthrough
Yes
Sample Time
Inherited from driving block
Scalar Expansion
Yes
Zero Crossing
No, unless Enable zero crossing detection is selected

See Also

Multi-Port Switch


Previous page  Sum Switch Case Next page

Learn more about the latest releases of MathWorks products:

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