Vektor - Element index
This function block determines the index of an element of the vector VC with a given value x.
The vector will be searched beginning from index Ind. The index of the first match will be assigned to output xPos. If no match can be found, -1 is given at the output.
For the data types FLOAT and DOUBLE the additional input Tol appears. Here it is possible to define a tolerance for the search.
Signals
| Name | I/O | Type(s) | Function |
|---|---|---|---|
| VX | I | UCHAR, WORD, LONG, LONGLONG, FLOAT, DOUBLE | Input vector |
| x | I | UCHAR, WORD, LONG, LONGLONG, FLOAT, DOUBLE | Search value |
| Ind | I | WORD | Starting index |
| Tol | I | FLOAT, DOUBLE | Tolerance |
| xPos | O | WORD | Index of the value or -1 |
Comments
The vector starts with the index 0.
The data type will be assigned by connecting an input signal.