DSP Blockset | ![]() ![]() |
Select a subset of rows or columns from the input.
Library
Signal Management / Indexing
Description
The Variable Selector block extracts a subset of rows or columns from the M-by-N input matrix at the In
port, u.
When the Select parameter is set to Rows, the Variable Selector block extracts rows from the 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 u 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 u 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
and the column selection operation is equivalent to
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:
Note The Variable Selector block always copies the selected input rows to a contiguous block of memory (unlike the Simulink Selector block). |
Dialog Box
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.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.Supported Data Types
To learn how to convert to the above data types in MATLAB and Simulink, see Supported Data Types and How to Convert to Them.
See Also
Multiport Selector |
DSP Blockset |
Permute Matrix |
DSP Blockset |
Selector |
Simulink |
Submatrix |
DSP Blockset |
Also see Indexing for a list of all the blocks in the Indexing library.
![]() | Variable Integer Delay | Variance | ![]() |