Variable Selector - Select subset of rows or columns from input

Library

Signal Management / Indexing

dspindex

Description

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:

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.

Dialog Box

Number of input signals

Specify the number of input signals. An input port is created on the block for each input signal.

Select

The dimension of the input to select, Rows or Columns.

Selector mode

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.

Elements

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.

Index mode

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.

Invalid index

Response to an invalid index value. Tunable.

Fill empty spaces in outputs (for logical indexing)

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.

Fill values

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.

Supported Data Types

PortSupported Data Types

In

  • Double-precision floating point

  • Single-precision floating point

  • Fixed point (signed and unsigned)

  • Boolean

  • 8-, 16-, and 32-bit signed integers

  • 8-, 16-, and 32-bit unsigned integers

Idx

  • Double-precision floating point

  • Single-precision floating point

  • Boolean

  • 8-, 16-, and 32-bit signed integers

  • 8-, 16-, and 32-bit unsigned integers

Out

  • Double-precision floating point

  • Single-precision floating point

  • Fixed point (signed and unsigned)

  • Boolean

  • 8-, 16-, and 32-bit signed integers

  • 8-, 16-, and 32-bit unsigned integers

See Also

Multiport SelectorSignal Processing Blockset
Permute MatrixSignal Processing Blockset
SelectorSimulink
SubmatrixSignal Processing Blockset

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS