| Signal Processing Blockset™ | ![]() |
Signal Management / Indexing
dspindex

The Variable Selector block extracts a subset of rows or columns from the M-by-N input matrix u at each input port. You specify the number of input and output ports in the Number of input signals parameter.
When the Select parameter is set to Rows, the Variable Selector block extracts rows from each input matrix, while if the Select parameter is set to Columns, the block extracts columns.
When the Selector mode parameter is set to Variable, the length-L vector input to the Idx port selects L rows or columns of each input to pass through to the output. The elements of the indexing vector can be updated at each sample time, but the vector length must remain the same throughout the simulation.
When the Selector mode parameter is set to Fixed, the Idx port is disabled, and the length-L vector specified in the Elements parameter selects L rows or columns of each input to pass through to the output. The Elements parameter is tunable, so you can change the values of the indexing vector elements at any time during the simulation; however, the vector length must remain the same.
For both variable and fixed indexing modes, the row selection operation is equivalent to
y = u(idx,:) % Equivalent MATLAB code
and the column selection operation is equivalent to
y = u(:,idx) % Equivalent MATLAB code
where idx is the length-L indexing vector. The row selection output size is L-by-N and the column selection output size is M-by-L. Input rows or columns can appear any number of times in the output, or not at all.
When the input is a 1-D vector, the Select parameter is ignored; the output is a 1-D vector of length L containing those elements specified by the length-L indexing vector.
When an element of the indexing vector references a nonexistent row or column of the input, the block reacts with the behavior specified by the Invalid index parameter. The following options are available:
Clip index — Clip the index to the nearest valid value, and do not issue an alert. Example: For a 64-by-N input, an index of 72 is clipped to 64; an index of -2 is clipped to 1.
Clip and warn — Display a warning message in the MATLAB® Command Window, and clip as above.
Generate error — Display an error dialog box and terminate the simulation.
When the indexing vector elements are of Boolean data type, the block performs logical indexing. Select Fill empty spaces in outputs (for logical indexing) to access the Fill values parameter. These values are appended to the output to make it as long as the input elements.
Note The Variable Selector block always copies the selected input rows to a contiguous block of memory (unlike the Simulink® Selector block). |

Specify the number of input signals. An input port is created on the block for each input signal.
The dimension of the input to select, Rows or Columns.
The type of indexing operation to perform, Variable or Fixed. Variable indexing uses the input at the Idx port to select rows or columns from the input at the In port. Fixed indexing uses the Elements parameter value to select rows from the input at the In port, and disables the Idx port.
A vector containing the indices of the input rows or columns that will appear in the output matrix. This parameter is only visible when you select Fixed for the Selector mode parameter.
When set to One-based, an index value of 1 refers to the first row or column of the input. When set to Zero-based, an index value of 0 refers to the first row or column of the input.
Response to an invalid index value. Tunable.
When the indexing vector elements are of Boolean data type, the block performs logical indexing. This can cause empty spaces in the output. Select this parameter to designate values to be appended to the output in the Fill values parameter.
Specify the fill values when the block performs logical indexing. This parameter is only visible when the Fill empty spaces in outputs (for logical indexing) parameter is selected.
| Port | Supported Data Types |
|---|---|
In |
|
Idx |
|
Out |
|
| Multiport Selector | Signal Processing Blockset |
| Permute Matrix | Signal Processing Blockset |
| Selector | Simulink |
| Submatrix | Signal Processing Blockset |
![]() | Variable Integer Delay | Variance | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |