Merge - Combine multiple signals into single signal

Library

Signal Routing

Description

The Merge block combines its inputs into a single output line whose value at any time is equal to the most recently computed output of its driving blocks. You can specify any number of inputs by setting the block's Number of inputs parameter.

A Merge block does not accept signals whose elements have been reordered or partially selected. For example, in the following diagram, the Merge block does not accept the output of the first Selector block because the Selector block interchanges the first and last elements of the vector signal. It does not accept the output of the second Selector block because the Selector block selects only the first three elements.

If the Allow unequal port widths parameter is not selected, the block accepts only inputs of equal dimensions and outputs a signal of the same dimensions as the inputs. If you select the Allow unequal port widths option, the block accepts scalars and vectors (but not matrices) having differing numbers of elements. Further, the block allows you to specify an offset for each input signal relative to the beginning of the output signal. The width of the output signal is

max(w1+o1, w2+o2, ... wn+on)

where w1, ... wn are the widths of the input signals and o1, ... on are the offsets for the input signals. For example, the Merge block in the following diagram has a Merge block width of

max(2+0,2+1)=3

In this example, the offset of v1 is 0 and the offset of v2 is 1. The Merge block maps the elements of v1 to the first two elements of v3 and the elements of v2 to the last two elements of v3. Only the second element of v3 is effectively merged, as seen from the scopes output.

You can specify an initial output value by setting the block's Initial output parameter. If you do not specify an initial output and one or more of the driving blocks do, the Merge block's initial output equals the most recently evaluated initial output of the driving blocks.

Merging S-Function Outputs

The Merge block can merge a signal from an S-Function block only if the memory used to store the S-Function block's output is reusable. Simulink® software displays an error message if you attempt to update or simulate a model that connects a nonreusable port of an S-Function block to a Merge block. See ssSetOutputPortOptimOpts for more information.

Guidelines for Using Merge Block

When using the Merge block, consider the following:

Data Type Support

The Merge block accepts real or complex signals of any data type supported by Simulink software, including fixed-point data types. All inputs must be of the same data type and numeric type.

For a discussion on the data types supported by Simulink software, see Data Types Supported by Simulink® in the Simulink documentation.

Parameters and Dialog Box

Number of inputs

The number of input ports to merge.

Initial output

Initial value of output. If unspecified, the initial output equals the initial output, if any, of one of the driving blocks. Simulink software does not allow you to set the initial output of this block to inf or NaN.

Allow unequal port widths

Allows the block to accept inputs having different numbers of elements.

Input port offsets

Vector specifying the offset of each input signal relative to the beginning of the output signal.

Bus Support

The Merge block is a bus-capable block. The inputs can be virtual or nonvirtual bus signals subject to the following restrictions:

Characteristics

Bus-capableYes, with restrictions as noted above

Direct Feedthrough

Yes

Sample Time

Inherited from the driving block

Scalar Expansion

No

Dimensionalized

Yes

Multidimensionalized

Yes

Zero Crossing

No

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS