Selector
Select input elements from vector, matrix, or multidimensional signal
- Library:
Simulink / Signal Routing
Description
TheSelectorblock generates as output selected or reordered elements of an input vector, matrix, or multidimensional signal.
Based on the value you enter for theNumber of input dimensionsparameter, a table of indexing settings is displayed. Each row of the table corresponds to one of the input dimensions inNumber of input dimensions. For each dimension, you define the elements of the signal to work with. Specify a vector signal as a 1-D signal and a matrix signal as a 2-D signal. When you configure theSelectorblock for multidimensional signal operations, the block icon changes.
For example, assume a 6-D signal with a one-based index mode. The table of the Selector block dialog changes to include one row for each dimension. If you define dimensions with these entries:
Row | Index Option | Index | Output Size |
---|---|---|---|
1 | Select all |
||
2 | Starting index (dialog) |
2 |
5 |
3 | Index vector (dialog) |
[1 3 5] |
|
4 | Starting index (port) |
8 |
|
5 | Index vector (port) |
||
6 | Starting and ending indices (port) |
The output will beY=U(1:end,2:6,[1 3 5],Idx4:Idx4+7,Idx5, Idx6(1):Idx6(2))
, whereIdx4
,Idx5
, andIdx6
are the index ports for dimensions 4, 5, and 6.
You can use an array of buses as an input signal to a Selector block. For details about defining and using an array of buses, seeCombine Buses into an Array of Buses.
Ports
Input
Output
Parameters
Model Examples
Block Characteristics
Data Types |
|
Multidimensional Signals |
|
Variable-Size Signals |
|