Distribute arbitrary subsets of input rows or columns to multiple output ports
Signal Management / Indexing
dspindex
The Multiport Selector block extracts multiple subsets of rows or columns from M-by-N input matrix u, and propagates each new submatrix to a distinct output port. The block treats an unoriented length-M vector input as an M-by-1 matrix.
The Indices to output parameter is a cell array whose kth cell contains a one-dimensional indexing expression specifying the subset of input rows or columns to be propagated to the kth output port. The total number of cells in the array determines the number of output ports on the block.
When you set the Select parameter to
Rows
, the block uses the one-dimensional indices you
specify to select matrix rows, and all elements on the chosen rows are included. When
you set the Select parameter to Columns
,
the block uses the one-dimensional indices you specify to select matrix columns, and all
elements on the chosen columns are included. A given input row or column can appear any
number of times in any of the outputs, or not at all.
When an index references a nonexistent row or column of the input, the block reacts with the action you specify using the Invalid index parameter.
Consider the following Indices to output cell array:
{4,[1:2 5],[7;8],10:-1:6}
This is a four-cell array, which requires the block to generate four independent
outputs (each at a distinct port). The table below shows the dimensions of these
outputs when Select = Rows
and the
input dimension is M-by-N.
Cell | Expression | Description | Output Size |
---|---|---|---|
1 |
| Row 4 of input | 1-by-N |
2 |
| Rows 1, 2, and 5 of input | 3-by-N |
3 |
| Rows 7 and 8 of input | 2-by-N |
4 |
| Rows 10, 9, 8, 7, and 6 of input | 5-by-N |
Specify the dimension of the input to select,
Rows
or
Columns
.
A cell array specifying the row- or column-subsets to propagate to each of the output ports. The number of cells in the array determines the number of output ports on the block.
Specify how the block handles an invalid index value. You can select one of the following options:
Clip index
— Clip the index to
the nearest valid value, and do not issue an alert.
For example, if the block receives a
64
-by-4
input and the
Select parameter is set to
Rows
, the block clips an index of
72
to 64
. For the same
input, if the Select parameter is set to
Columns
, the block clips an index of
72
to 4
. In both cases,
the block clips an index of -2
to
1
.
Clip and warn
— Clip the index
to the nearest valid value and display a warning message at the
MATLAB® command line.
Generate error
— Display an
error dialog box and terminate the simulation.
Port | Supported Data Types |
---|---|
Input |
|
Outputs |
|
Permute Matrix | DSP System Toolbox |
Selector (Simulink) | Simulink |
Submatrix | DSP System Toolbox |
Variable Selector | DSP System Toolbox |