Products & Services Industries Academia Support User Community Company

Learn more about Simulink   

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:

  • Select all

    This is the default. No further configuration is required. All elements are selected.

  • Index vector (dialog)

    Enables the Index column. Enter the vector of indices of the elements.

  • Index vector (port)

    No further configuration is required.

  • Starting index (dialog)

    Enables the Index and Output Size columns. Enter the starting index of the range of elements to be selected in the Index column and the number of elements to be selected in the Output Size column.

  • Starting index (port)

    Enables the Output Size column. Enter the number of elements to be selected in the Output Size column.

The Index and Output Size columns appear as relevant.

Index

If the Index Option is Index vector (dialog), enter the index of each element in which you are interested.

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 How to Specify the Sample Time in the online documentation for more information.

    Note   For 1-D signals, the Sample time parameter is applicable only with the Index Option set to Starting index (port) or Index vector (port). For all other Input Option settings, the Selector block becomes a virtual block and the Sample time parameter does not appear.

Characteristics

Sample Time

Specified in the Sample time parameter

Dimensionalized

Yes

Multidimensionalized

Yes

Virtual

Yes, when Number of input dimensions is 1 and Index Option is Select all, Index vector (dialog), or Starting index (dialog)

For more information, see Virtual Blocks in the Simulink documentation.

Zero crossing

No

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

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