| Simulink Reference | ![]() |
Perform the specified relational operation on the inputs
Library
Description
The Relational Operator block performs the specified comparison of its two inputs.
You select the relational operator connecting the two inputs with the Relational Operator parameter. The block updates to display the selected operator. The supported operations are given below.
You can specify inputs as scalars, arrays, or a combination of a scalar and an array:
The input with the smaller positive range is converted to the data type of the other input offline using round-to-nearest and saturation. This conversion is performed prior to comparison.
The output data type is specified with the Output data type mode and Output data type parameters. The output equals 1 for TRUE and 0 for FALSE.
| Note The output data type selected should represent zero exactly. Data types that satisfy this condition include signed and unsigned integers and any floating-point data type. |
Data Type Support
The Relational Operator block accepts real or complex signals of any data type supported by Simulink, including fixed-point data types. However, if the Output data type mode parameter is set to Logical, the input may only be Boolean or double. One input can be real and the other complex if the operator is == or !=.
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
The Main pane of the Relational Operator block appears as follows:
-1. See Specifying Sample Time in the online documentation for more information.
The Signal data types pane of the Relational Operator block appears as follows:
Boolean, or choose to specify the data type through the Output data type parameter.
Logical to have the output data type determined by the Implement logic signals as boolean data parameter in the Simulation and code generation optimization pane of the Configuration Parameters dialog box. If you select Logical and Boolean Logic Signals is on, then the output data type is always Boolean. If you select Logical and Implement logic signals as boolean data is off, then the output data type will match the input data type, then the output data type will match the input data type, which is always double.
Specify via dialog for the Output data type mode parameter.
Characteristics
| Direct Feedthrough |
Yes |
| Sample Time |
Specified in the Sample time parameter |
| Scalar Expansion |
Yes, of inputs |
| Dimensionalized |
Yes |
| Zero Crossing |
Yes, if enabled. |
| Real-Imag to Complex | Relay | ![]() |
© 1994-2005 The MathWorks, Inc.