Relational Operator
Compares the input signals.
blockType: RelationalOperator
Path in the library:
|
Description
Block Relational Operator compares the input signals in a specified way. Parameter Value Relational operator determines whether the unit accepts one or two input signals.
Two-input mode
By default, the block Relational Operator compares two inputs as specified by the parameter Relational operator.
In the two-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 smaller 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. |
The input signals can be scalars, arrays, or a combination of both.
| For… | The way out is this… |
|---|---|
Scalar inputs |
scalar |
Inputs in the form of arrays |
An array of the same size, where each element is the result of an element-by-element 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. |
Dimension expansion is supported. For example, if the first input is an array of size 4 on 1, and on the second one there is an array of size 1 on 5, then the output will be a matrix of size 4 on 5.
The output is 1 if the comparison condition is satisfied, and 0 — if it is not executed.
Single entry mode
When selecting one of the following values Relational operator The unit switches to single-input mode:
| Operation | Description |
|---|---|
|
True if the input is |
|
True if the input is |
|
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 |
|---|---|---|
With a fixed point |
|
False |
Logical |
|
False |
Integer |
|
Truly |
Ports
Output
#
OUT_1
—
The output signal
scalar | vector | the matrix
Details
An output signal consisting of zeros and ones. The signal has the same dimension as the input. The type of output data is set by the parameter Output data type.
| Data types |
|
| Complex numbers support |
No |
Input
#
IN_1
—
the first input signal
scalar | vector | the matrix
Details
The first input signal is in the form of a scalar, vector, or matrix.
| Data types |
|
| Complex numbers support |
No |
#
IN_2
—
the second input signal
scalar | vector | the matrix
Details
The second input signal is in the form of a scalar, vector, or matrix.
Dependencies
To use this port, set the parameter Relational operator values ==, ~=, <, ⇐, >= or >.
| Data types |
|
| Complex numbers support |
No |
Parameters
Main
#
Relational operator —
comparison operator
== | ~= | < | ⇐ | >= | > | isInf | isNaN | isFinite
Details
Specifies an operation for comparing two inputs or determining 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 smaller 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 entrance is finite.
| Values |
|
| Default value |
|
| Program usage name |
|
| Tunable |
No |
| Evaluatable |
No |
Main
#
Output data type —
type of output data
Bool | UInt8
Details
Specify the type of output data.
| Values |
|
| Default value |
|
| Program usage name |
|
| Tunable |
No |
| Evaluatable |
No |