Relational Operator
Compares input signals.
Description
The Relational Operator block compares input signals in the specified way. The value of the Relational operator parameter determines whether the block accepts one or two input signals.
Dual input mode
By default, the Relational Operator block compares two inputs as specified by the Relational operator parameter.
In Dual Input Mode, you can select one of the following operations:
Operation | Description |
---|---|
|
True if the first input is equal to the second input. |
|
True if the first input is not equal to the second input. |
|
True if the first input is less than the second input. |
|
True if the first input is less than or equal to the second input. |
|
True if the first input is greater than or equal to the second input. |
|
True if the first input is greater than the second input. |
Input signals can be scalars, arrays, or a combination of both.
For. | An output is… |
---|---|
Scalar inputs |
scalar |
Array inputs |
An array of the same size, where each element is the result of a piecewise comparison of the input arrays. |
Mixed inputs: scalars and arrays |
An array where each element is the result of comparing a scalar and the corresponding array element. |
Expansion of dimensions is supported. For example, if the first input is an array of size 4x1 and the second input is an array of size 1x5, the output will be a 4x5 matrix.
The output is 1
if the comparison condition is met, and 0
if it is not met.
Single input mode
When one of the following Relational operator values is selected, the unit switches to single input mode:
Operation | Description |
---|---|
isInf |
True if the input is Inf |
isNaN |
True if the input is NaN |
isFinite |
True if the input is finite |
For an input whose data type is not a floating point type, the block returns the following values:
Data type | Operation | Block output |
---|---|---|
Fixed point |
isInf |
False |
Logical |
isNaN |
False |
Integer |
isFinite |
True |
Ports
Input
Port_1 - first input signal
scalar
| vector
| matrix
First input signal as a scalar, vector or matrix.
Data types: Float16
, Float32
, Float64
, Int8
, Int16
, Int32
, Int64
, Int128
, UInt8
, UInt16
, UInt32
, UInt64
, UInt128
, Bool
.
*Support for complex numbers: Yes
Port_2 - second input signal
scalar
| vector
| matrix
Second input signal as a scalar, vector or matrix.
Dependencies
To use this port, set the Relational operator parameter to , , , , , or .
Data types: Float16
, Float32
, Float64
, Int8
, Int16
, Int32
, Int64
, Int128
, UInt8
, UInt16
, UInt32
, UInt64
, UInt128
, Bool
.
*Support for complex numbers: Yes
Parameters
Relational operator - comparison operator
< = (by default)
| ~=
| ==
| <
| ⇐
| >=
| >
| isInf
| isNaN
| isFinite
Specifies an operation to compare two inputs or to determine the signal type of one input.
-
- true if the first input is equal to the second input.
-
- true if the first input is not equal to the second input.
-
- true if the first input is less than the second input.
-
- true if the first input is less than or equal to the second input.
-
- true if the first input is greater than or equal to the second input.
-
- true if the first input is greater than the second input.
-
isInf - true if the input is Inf.
-
isNaN - true if the input is NaN.
-
isFinite - true if the input is finite.
Block parameter |
|
Value |
|
By default |
|
Output data type - output data type
Bool (by default)
| Uint8
Specify the type of output data.
Block parameter |
|
Value |
|
By default |
|