To index, create a selection of a subset of elements from a vector, matrix or signal.
For example:
We can use four indexing methods to get elements from the signal above.
Calulator Input
Use the
and buttons to complete the operation.Vector Index: x[i]
The operation returns the component with index i of the input object x. If x has n components, i may be some integer value between 0 and n-1. If x is a signal this operation returns a vector with the abscissa value in the first cell and the corresponding ordinates of every channel in the following cells.
Types
Variable Name | Value Type | Variable Type | ||
---|---|---|---|---|
Arguments: | x | real, complex | vector, signal, xy-data | |
i | real | scalar | ||
Result: | z | real, complex | scalar, vector Example |
Example
ID | Description | Type | Value | Expression | |
---|---|---|---|---|---|
x | Argument | REAL SIGNAL | signal([0, 0.5, 1],[3, 6, 9],[7, 14, 21]) | ||
i | Argument | REAL | 0 | 0 | |
z | Result | REAL VECTOR |
| x[i] |
Matrix Index: x[i,j]
The operation returns the entry of the cell with the indices i (row) and j (column) of the matrix. If x has n rows and m columns, i may be an integer between 0 and n-1 and j between 0 and m-1.
In case x is of kind signal this operator returns the data of channel i+1 at the j+1-th timestep. For signals with m channels and n timesteps the valid indices are and .
Types
Variable Name | Value Type | Variable Type | ||
---|---|---|---|---|
Arguments: | x | real, complex | matrix, signal, xy-data | |
i | real | scalar | ||
j | real | scalar | ||
Result: | z | real, complex | scalar |
Example
ID | Description | Type | Value | Expression | |
---|---|---|---|---|---|
x | Argument | REAL SIGNAL | signal([0, 0.5, 1],[3, 6, 9],[7, 14, 21]) | ||
i | Argument | REAL | 0 | 0 | |
j | Argument | REAL | 0 | 0 | |
z | Result | REAL | 3 | x[i,j] |
i-th Row: x[i,]
The operation returns the i+1-th row of the matrix x. If x has n rows, i may be an integer between 0 and n-1.
For signals the operation returns the values of the i+1-th channel of the signal x.
Types
Variable Name | Value Type | Variable Type | ||
---|---|---|---|---|
Arguments: | x | real, complex | matrix, signal, xy-data | |
i | real | scalar | ||
Result: | z | real, complex | vector |
Example
ID | Description | Type | Value | Expression | |
---|---|---|---|---|---|
x | Argument | REAL SIGNAL | signal([0, 0.5, 1],[3, 6, 9],[7, 14, 21]) | ||
i | Argument | REAL | 0 | 0 | |
z | Result | REAL VECTOR |
| x[i,] |
j-th Column: x[,j]
The operation returns the j+1-th column of the matrix x. If x has m columns, j may be an integer between 0 and m-1.
For signals the operation returns the values of the j+1-th timestep of all channels of signal x.
Types
Variable Name | Value Type | Variable Type | ||
---|---|---|---|---|
Arguments: | x | real, complex | matrix, signal, xy-data | |
j | real | scalar | ||
Result: | z | real, complex | vector |
Example:
ID | Description | Type | Value | Expression | |
---|---|---|---|---|---|
x | Argument | REAL SIGNAL | signal([0, 0.5, 1],[3, 6, 9],[7, 14, 21]) | ||
j | Argument | REAL | 0 | 0 | |
z | Result | REAL VECTOR | x[,j] |