DSP Blockset
  Go to block:
    Search    Help Desk 
Variable Selector    See Also

Select a subset of elements in a vector.

Library

Elementary Functions, in Math Functions

Description

The Variable Selector block outputs a subset of the elements in the input vector.

When the Selector mode parameter is set to Variable, the vector at the bottom input (Idx) selects the elements of the vector at the top input (In) to pass through to the output. The elements of the indexing vector can change at each sample time, but the vector must remain the same length throughout the simulation.

When the Selector mode parameter is set to Fixed, the vector specified in the Elements parameter selects the elements of the top input vector (In) 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 indexing vector must remain the same length. The Idx port is not present in Fixed mode.

For both variable and fixed indexing vectors, the selection operation is equivalent to

where u(1) is the first input element and idx is the indexing vector. The output is therefore the same length as the indexing vector. Input elements can appear any number of times in the output, or not at all.

When an element in the indexing vector references a non-existent element 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 elements to a contiguous block of memory (unlike the Simulink Selector block).

Dialog Box

Selector mode
The type of indexing operation to perform, Variable of Fixed. Variable indexing uses the input at the Idx port to select elements of the input at the In port. Fixed indexing uses the Elements parameter value to select elements of the input at the In port.
Elements 
A vector containing the indices of the input elements that will appear in the output vector.
Invalid index 
Response to an invalid index value.

See Also

Permute Matrix
Selector (Simulink)
Submatrix


[ Previous | Help Desk | Next ]