merge

Scalar:

Matrix:

Block Category: Nonlinear, Fixed Point

Inputs: Real, complex, or fixed-point (scaled_int) scalars, or vectors, matrices, or alphanumeric strings. If x1 is a matrix, x2 and x3 should have the same dimension.

Description: The merge block expects a Boolean signal on x1. If the signal on x1 is floating point, it is automatically truncated to integer. The block output is the value presented on x2 if x1 is nonzero; otherwise, the output is x3. The letters b, t, and f on the input connectors indicate Boolean, True, and False.

The merge block is particularly well-suited for performing if-then-else decisions.

Label: Indicates a user-defined block label that appears when View > Block Labels is activated.

 

Examples

1. Simple If-Then-Else using merge block

merge blk example 1

2. Cascading If-Then-Else using merges

merge blk example 2