SearchValue (FPScript)
Searches for one or more values in a data set.
Syntax
SearchValue(DataSet, Value)
The syntax of the SearchValue function consists of the following parts:
Part |
Description |
---|---|
DataSet |
A data series or signal to be searched for values. If you specify a signal, only the Y component is searched. All data structures are allowed, except scalar value und list. All numeric data types are permitted. If the argument is a list, then the function is executed for each element of the list and the result is also a list. |
Value |
A scalar value or a data series with the values to be found. If the value Empty is passed, the function also returns the result Empty. Permitted data structures are scalar value und data series. All numeric data types are permitted. The unit has to be compatible with that of parameter DataSet. If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated. |
Remarks
All numerical data types are allowed. If DataSet is one dimensional, the result is a scalar value or a data series with the found value positions. Otherwise, it is a data matrix with the 2D indices of the found values. The value to be found does not have to be present exactly in the data set. The position of the value in the data set that comes closest to the search value is then passed. If this applies to several identical values in the data set, the position of the first of these values is then passed. The Value argument cannot contain void floating point values.
For complex data types the absolute value is formed.
Available in
FlexPro Basic, Professional, Developer Suite
Examples
SearchValue({1,2,3,2,1}, 2) |
Results in 1L. This corresponds to the position of the first "2" in the data set. |
Signal.y[SearchValue(Signal.X, 1.5)] |
Corresponds to Signal[[1.5]]. |
SearchValue({1,2,3,2,1}, {2.1, 2.9}) |
Results in {1L, 2L}. |