| Simulink® | ![]() |
Signal Routing

The Selector block generates as output selected or reordered elements of an input vector, matrix, or multidimensional signal.
A Selector block accepts vector, matrix, or multidimensional signals as input. The parameter dialog box and the block's appearance change to reflect the number of dimensions of the input.
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 5-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 each dimension with the following entries:
1
Index Option, select Select all
2
Index Option, select Starting index (dialog)
Index, enter 2
Output Size, enter 5
3
Index Option, select Index vector (dialog)
Index, enter [1 3 5]
4
Index Option, select Starting index (port)
Output Size, enter 8
5
Index Option, select Index vector (port)
The output will be Y=U(1:end,2:6,[1 3 5],Idx4:Idx4+7,Idx5), where Idx4 and Idx5 are the index ports for dimensions 4 and 5.
The data port of the Selector block accepts signals of any signal type and any data type supported by Simulink software, including fixed-point and enumerated data types. The data port accepts mixed-type signals. The index port accepts only built-in data types, except boolean data types. The elements of the output have the same type as the corresponding selected input elements.
For a discussion on the data types supported by Simulink software, see Data Types Supported by Simulink in the Simulink documentation.
The parameter dialog box appears as follows when you set Index Option to Starting index (port).

Enter the number of dimensions of the input signal.
Specifies the indexing mode: One-based or Zero-based. If One-based is selected, an index of 1 specifies the first element of the input vector, 2, the second element, and so on. If Zero-based is selected, an index of 0 specifies the first element of the input vector, 1, the second element, and so on.
Define, by dimension, how the elements of the signal are to be indexed. From the list, choose:
Select all
This is the default. No further configuration is required. All elements are selected.
Index vector (dialog)
Enables the Index column. Enter the vector of indices of the elements.
Index vector (port)
No further configuration is required.
Starting index (dialog)
Enables the Index and Output Size columns. Enter the starting index of the range of elements to be selected in the Index column and the number of elements to be selected in the Output Size column.
Starting index (port)
Enables the Output Size column. Enter the number of elements to be selected in the Output Size column.
The Index and Output Size columns are displayed as relevant.
If the Index Option is Index vector (dialog), enter the index of each element you are interested in.
If the Index Option is Starting index vector (dialog), enter the starting index of the range of elements to be selected.
Enter the width (number of elements from the starting point) of the block output signal.
Specify the width of the block input signal (-1 for inherited) — 1-D signals only.
Specify the time interval between samples. To inherit the sample time, set this parameter to -1. See Specifying Sample Time in the online documentation for more information.
Note For 1–D signals, the Sample time parameter is applicable only with the Index Option set to Starting index (port) or Index vector (port). For all other Input Option settings, the Selector block becomes a virtual block and the Sample time parameter does not appear. |
Sample Time | Specified in the Sample time parameter. |
Dimensionalized | Yes |
Multidimensionalized | Yes |
Zero crossing | No |
![]() | Scope and Floating Scope | S-Function | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |