This example shows how to use the For Each Subsystem. In this example the operations are performed on a vector for simplicity.
The inputs to the For Each Subsystem are: the signals to process, the coefficients of the FIR filter to use with each of these signals, and the common gain.
Each signal is scalar and needs to be processed individually. Consequently, the For Each Block that controls the partition dimension is set to partition the input signal along dimension 1, by slicing through a partition width of 1. For each input signal, a corresponding set of coefficients must also be partitioned using the same criterion. The gain is common to all the signals, thus this input is not partitioned.
Since the output signal dimension is expected to match the input signal dimension, the concatenation dimension is set equal to the partition dimension. If you prefer to change the signal dimension (a transpose in this case), you can choose 2 as the concatenation dimension.
For the For Each Subsystem, you must set the partition dimension and width, but not the input signal size. A check then ensures that this size is a multiple of the partition width. If no error is detected, the subsystem then calculates the number of independent executions that the enclosed subsystem will perform. These executions are independent, in that, the state associated with a given contained block has a unique value in each of the respective executions.
To see a non-vectorized implementation for this model, double-click on the subsystem in the left corner of the model. This implementation does not use the For Each Subsystem. It mimics its functionality by replicating the subsystem as many times as necessary and also by selecting and concatenating the signals appropriately. This replication process is prone to error and is not scalable- changing the input signal size would require changing the model accordingly.