Select input elements from vector, matrix, or multidimensional signal
Simulink / Signal Routing
HDL Coder / Signal Routing
The Selector block generates as output selected or reordered elements of an input vector, matrix, or multidimensional signal.
Based on the value you enter for the Number of input dimensions parameter, a table of indexing settings is displayed. Each row of the table corresponds to one of the input dimensions in Number 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 the Selector block 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 as shown in the next table, the output is Y =
U(1:end,2:6,[1 3 5],Idx4:Idx4+7,Idx5,Idx6(1):Idx6(2))
, where
Idx4
, Idx5
, and Idx6
are
the index ports for dimensions 4, 5, and 6.
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) |
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, see Combine Buses into an Array of Buses.
Data Types |
|
Direct Feedthrough |
|
Multidimensional Signals |
|
Variable-Size Signals |
|
Zero-Crossing Detection |
|