| Simulink Reference | ![]() |
Determine how a signal compares to the specified constant
Library
Description
The Compare To Constant block compares an input signal to a constant. Specify the constant in the Constant value parameter. Specify how the input is compared to the constant value with the Operator parameter. The Operator parameter can have the following values:
== -- Determine whether the input is equal to the specified constant.
= -- Determine whether the input is not equal to the specified constant.
< -- Determine whether the input is less than the specified constant.
<= -- Determine whether the input is less than or equal to the specified constant.
> -- Determine whether the input is greater than the specified constant.
>= -- Determine whether the input is greater than or equal to the specified constant.
The output is 0 if the comparison is false, and 1 if it is true.
Data Type Support
The Compare To Constant block accepts inputs of any data type supported by Simulink, including fixed-point data types. The block output is uint8 or Boolean as specified by the Output data type mode parameter.
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
uint8 or Boolean.
Characteristics
| Direct Feedthrough |
Yes |
| Scalar Expansion |
Yes |
| Zero Crossing |
Yes, if enabled. |
See Also
| Combinatorial Logic | Compare To Zero | ![]() |
© 1994-2005 The MathWorks, Inc.