Vector - Rank of value

This function block determines the rank of the value x within the given vector VX.

The position where the value would be sorted in at the vector VX will be determined. To get meaningful results a sorting of the input vector is presumed and the sorting order has to be specified.

If the position of the value is beyond the last element of the vector, the result will be set to the last index, but the output bOoR (Out of Range) will be set to HIGH, otherwise this output is LOW.

 

Operations

bAscend = HIGH: Ascending order given

bAscend = LOW: Descending order given

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 Input value
bAscend I Bit Sorting order
bOoR O Bit Overflow flag
xPos O WORD Index within the vector

Comments

The vector starts with the index 0.

The data type will be assigned by connecting an input signal.