Selector
Selects the given elements from the input vector, matrix or multidimensional array.
blockType: Selector
Path in the library:
|
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 |
|
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 |
|
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 |
|
Complex numbers support |
No |
Parameters
Parameters
#
Number of input dimensions —
description missing
Real number
Details
description missing
Default value |
|
Program usage name |
|
Tunable |
No |
Evaluatable |
Yes |
#
Index mode —
description missing
Zero-based
| One-based
Details
description missing
Values |
|
Default value |
|
Program usage name |
|
Tunable |
No |
Evaluatable |
No |
#
Input port size —
description missing
Integer
Details
description missing
Default value |
|
Program usage name |
|
Tunable |
No |
Evaluatable |
Yes |
Index 1
#
Index option —
description missing
Select all
| Index vector (dialog)
| Index vector (port)
| Starting index (dialog)
| Starting index (port)
| Starting and ending indices (dialog)
Details
description missing
Values |
|
Default value |
|
Program usage name |
|
Tunable |
No |
Evaluatable |
No |
#
Index —
description missing
Scalar / array of real numbers
Details
description missing
Default value |
|
Program usage name |
|
Tunable |
No |
Evaluatable |
Yes |
#
Output size —
description missing
Scalar / array of real numbers
Details
description missing
Default value |
|
Program usage name |
|
Tunable |
No |
Evaluatable |
Yes |