Engee documentation

Selector

Selects the given elements from the input vector, matrix or multidimensional array.

blockType: Selector

Path in the library:

/Basic/Signal Routing/Selector

Description

The Selector block extracts selected elements of an input vector, matrix or multidimensional array based on specified indices. The extracted signals can be grouped differently than the input signals.

Depending on the value of the parameter Number of input dimensions the table of indexing parameters changes. Each row of the table corresponds to one of the input measurements in Number of input dimensions. An input signal must have no more than a certain number of measurements, specified as Number of input dimensions. For example, if Number of input dimensions equals , then the signal will be interpreted as -dimensional. For example, if the input is expected to be a scalar (one-dimensional) but Number of input dimensions equals 2, the scalar will be treated as two-dimensional. When configuring the Selector block for operations with multidimensional signals, the block icon changes.

Suppose we have an array of numbers U and we want to select a subarray Y of U using some numeric value Idx1 as an index.

Suppose we have an array U:

U = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

We want to select a subarray Y of size 8 from U, starting from the element with index Idx1:

Idx1 = 3
Y = U[Idx1:Idx1+7]

This means that we select elements with indices 3 to 10 from U. Thus, Y will contain the following values:

Y = [3, 4, 5, 6, 7, 8, 9, 10]

Here Y is a subarray of U starting from the third element and including the next 7 elements after it. Idx1 defines the initial index of the second dimension, and Idx1+7 defines the final index of the second dimension.

The Selector block uses similar behaviour to the getindex function in Julia (see Indexing for details ).

Parameters for the first index are given in the parameter group Index 1. The number of parameter groups depends on the number of dimensions (value of parameter Number of input dimensions). The set of parameters for each index is the same, they differ only in the name for programme code (the number at the end of the name means the index number).

Ports

Output

# Y — output signal
scalar | vector | matrix | multidimensional array

Details

An output signal composed of selected and/or reordered elements of the input signal.

Data types

Float16, Float32, Float64, Int8, Int16, Int32, Int64, Int128, UInt8, UInt16, UInt32, UInt64, Uint128, Fixed, Bool.

Complex numbers support

Yes

Input

# U — input signal
scalar | vector | matrix | multidimensional array

Details

The input signal from which elements are taken for the output signal.

Data types

Float16, Float32, Float64, Int8, Int16, Int32, Int64, Int128, UInt8, UInt16, UInt32, UInt64, Uint128, Fixed, Bool.

Complex numbers support

Yes

# IdxNind — port for setting the Nth index
scalar | vector | matrix

Details

An external port specifying an index to select the corresponding output element. Fractional values within a block are rounded to integers.

The name of the port depends on which index it refers to and on the value of the parameters Index mode.

If the parameter Index mode is set to . One-based`then the index in the port name is `1, if the value is Zero-based`then it is `0.

Dependencies

To use an external index port, set the parameters of the corresponding index Index option to 1. Index vector (port), Starting index (port).

Data types

Float16, Float32, Float64, Int8, Int16, Int32, Int64, Int128, UInt8, UInt16, UInt32, UInt64, Uint128, Fixed .

Complex numbers support

No

Parameters

Parameters

# Number of input dimensionsdescription missing
Real number

Details

description missing

Default value

1

Program usage name

NumberOfDimensions

Tunable

No

Evaluatable

Yes

# Index modedescription missing
Zero-based | One-based

Details

description missing

Values

Zero-based | One-based

Default value

One-based

Program usage name

IndexMode

Tunable

No

Evaluatable

No

# Input port sizedescription missing
Integer

Details

description missing

Default value

-1

Program usage name

InputPortWidth

Tunable

No

Evaluatable

Yes

Index 1

# Index optiondescription missing
Select all | Index vector (dialog) | Index vector (port) | Starting index (dialog) | Starting index (port) | Starting and ending indices (dialog)

Details

description missing

Values

Select all | Index vector (dialog) | Index vector (port) | Starting index (dialog) | Starting index (port) | Starting and ending indices (dialog)

Default value

Index vector (dialog)

Program usage name

IndexOptionArray1

Tunable

No

Evaluatable

No

# Indexdescription missing
Scalar / array of real numbers

Details

description missing

Default value

1

Program usage name

IndexParamArray1

Tunable

No

Evaluatable

Yes

# Output sizedescription missing
Scalar / array of real numbers

Details

description missing

Default value

1

Program usage name

OutputSizeArray1

Tunable

No

Evaluatable

Yes

Additional options

C code generation: Yes