Engee documentation

Variable Selector

Selects a subset of rows or columns from the input data.

variable selector

Description

Block Variable Selector extracts a subset of rows or columns from the input matrix u of size M by N on each input port. The number of input and output ports is set in the Number of input signals parameters.

If an element of the index vector references a non-existent row or column of the input signal, the block performs the action you specify with the Invalid index parameters.

If the index vector elements are of data type Bool, the block performs logical indexing. Check the Fill empty spaces in outputs (for logical indexing) parameters to use the Fill values parameter. These values are added to the output signal to make its length equal to the length of the input elements.

Ports

Input

# InN — Nth input signal
scalar | vector | matrix

Details

N-th input signal, where N is the number of inputs specified in the Number of input signals parameter.

Data types

Float16 | Float32 | Float64 | Int8 | Int16 | Int32 | Int64 | Int128 | Uint8 | Uint16 | Uint32 | Uint64 | Uint128 | Bool | Fixed-point

Complex numbers support

Yes

# Idx — vector of indices
scalar | vector

Details

Specify the scalar value or vector containing the indices of the input rows or columns that appear in the output matrix.

Data types

Float16 | Float32 | Float64 | Int8 | Int16 | Int32 | Int64 | Int128 | Uint8 | Uint16 | Uint32 | Uint64 | Uint128 | Bool

Complex numbers support

No

Output

# OutN — Nth output signal
scalar | vector | matrix

Details

Nth output signal corresponding to Nth input signal, where N is the number of inputs specified in the Number of input signals parameters. The output signal is returned as a scalar, vector or matrix of the same type, size and complexity as the corresponding input signal.

Data types

Float16 | Float32 | Float64 | Int8 | Int16 | Int32 | Int64 | Int128 | Uint8 | Uint16 | Uint32 | Uint64 | Uint128 | Bool | Fixed-point

Complex numbers support

Yes

Parameters

Main

# Number of input signals — number of input ports
Real number

Details

The number of input signals as a positive integer. An input port is created for each input signal in the block.

Default value

1

Program usage name

NumInputs

Tunable

No

Evaluatable

Yes

# Select — input dimension
Rows | Columns

Details

Select the dimension of the input:

  • Rows - the block extracts rows from each input matrix;

  • Columns - the block extracts columns from each input matrix.

The selected input row or column may appear any number of times in any of the outputs or not appear at all.

Values

Rows | Columns

Default value

Rows

Program usage name

rowsOrCols

Tunable

No

Evaluatable

No

# Selector mode — indexing mode
Fixed | Variable

Details

The type of indexing operation to be performed. Defined as:

  • Variable - a vector of length , fed to the input of port Idx, selects rows or columns of each input to be sent to the output. You can update the elements of the indexing vector at each sampling period, but the length of the vector must remain the same throughout the simulation period.

  • Fixed - The Idx port is disabled. A vector of length , which you specify in the Elements parameter, selects rows or columns of each input to be sent to the output. The Elements parameter is configurable, so you can change the values of the elements of the indexing vector at any time during the simulation, but the length of the vector must remain the same.

Values

Fixed | Variable

Default value

Variable

Program usage name

IdxMode

Tunable

No

Evaluatable

No

# Elements — indices of output matrix elements
Scalar / array of real numbers

Details

A vector containing the indices of the input rows or columns that appear in the output matrix.

Dependencies

To use this parameter, set the Selector mode parameter to Fixed.

Default value

[1 3]

Program usage name

Elements

Tunable

Yes

Evaluatable

Yes

# Index mode — indexing mode
Zero-based | One-based

Details

Indexing Mode. Defined as:

  • One-based - index value 1 refers to the first row or the first column of the input.

  • Zero-based - index value 0 refers to the first row or the first column of the input.

Values

Zero-based | One-based

Default value

One-based

Program usage name

ZerOneIdxMode

Tunable

No

Evaluatable

No

# Invalid index — error handling
Clip Index | Generate Error

Details

Specify how the block handles an invalid index value. Specified as:

  • Clip index - trim the index to the nearest valid value and do not generate a warning.

    For example, if the `[64, 4] signal is supplied to the block input and the Select parameters are set to:

    • Rows - the block cuts the index from 72 to 64.

    • Columns - the block truncates the index from 72 to 4.

      In both cases, the block trims the index from -2 to 1.

  • Generate error - output the error dialogue box and terminate the simulation.

Values

Clip Index | Generate Error

Default value

Clip index

Program usage name

errmode

Tunable

No

Evaluatable

No

# Fill empty spaces in outputs (for logical indexing) — option to fill in empty spaces in the output data
Logical

Details

When the elements of the indexing vector have the Bool data type, the block performs logical indexing. Logical indexing may result in empty spaces in the output data.

Select this check box to specify the values to be added to the output data in the Fill values parameters.

Default value

true (switched on)

Program usage name

FillMode

Tunable

No

Evaluatable

No

# Fill values — fill values

Details

Fill values when the block performs logical indexing.

Dependencies

To use this parameter, select the Fill empty spaces in outputs (for logical indexing) parameters check box.

Default value

0

Program usage name

FillValues

Tunable

No

Evaluatable

Yes

Literature