MinMax

Declaration: TVector.MinMax (LowElem, HighElem: integer; var Minimum, Maximum: double; var MinIx, MaxIx: integer);
The method MinMax calculates the minimum and the maximum value of the vector elements within a specified range. The range of the vector elements which are used for the calculation is determined by the parameters LowElem and HighElem. If any of these parameters receives an invalid value, this value is automatically adjusted to the most appropriate boundary (either 1 or NrOfElems). Setting both the LowElem and HighElem parameter to zero forces the method to process the entire range of vector elements.

Note, that in the case of the method MinMax the vector is not considered as a vector in its usual sense but merely as a collection of numbers.

The lowest and the highest value of the selected data are returned in the variable parameters Minimum and Maximum, their indices in the variable parameters MinIx and MaxIx.

Hint: Setting both LowElem and HighElem to zero values forces the method to scan the entire vector for the extreme values.