| Contents | Index |
Logic and Bit Operations
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.
The Compare To Constant block accepts inputs of any data type that Simulink supports, including fixed-point and enumerated data types. The block first converts its Constant value parameter to the input data type, and then performs the specified operation. The block output is uint8 or boolean as specified by the Output data type parameter.
For more information, see Data Types Supported by Simulink in the Simulink documentation.

Specify how the input is compared to the constant value, as discussed in Description.
Specify the constant value to which the input is compared.
Specify the data type of the output, uint8 or boolean.
Select to enable zero-crossing detection. For more information, see Zero-Crossing Detection.
Direct Feedthrough | Yes |
Scalar Expansion | Yes |
Multidimensionalized | Yes |
Zero-Crossing Detection | Yes, if enabled. |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |