Selector - Select input elements from vector, matrix, or multidimensional signal

Library

Signal Routing

Description

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:

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.

Data Type Support

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.

Parameters and Dialog Box

The parameter dialog box appears as follows when you set Index Option to Starting index (port).

Number of input dimensions

Enter the number of dimensions of the input signal.

Index mode

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.

Index Option

Define, by dimension, how the elements of the signal are to be indexed. From the list, choose:

The Index and Output Size columns are displayed as relevant.

Index

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.

Output Size

Enter the width (number of elements from the starting point) of the block output signal.

Input port size

Specify the width of the block input signal (-1 for inherited) — 1-D signals only.

Sample time (-1 for inherited)

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.

Characteristics

Sample Time

Specified in the Sample time parameter.

Dimensionalized

Yes

Multidimensionalized

Yes

Zero crossing

No

  


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