Support

Equilla Formula Language

CompareVector

Compares the elements in one vector to those in another vector. Returns 0 if they are equal, -1 if the first diffenence in the first element is less than the same element in the second vector, and 1 if the first different element is greater. -2 is returned if the vectors have differing sizes.

Inputs

Vector1
Numeric: The first vector to compare
Start1
Numeric: The index of the first element to compare from Vector1
Vector2
Numeric: The second vector to compare
Start2
Numeric: The index of the first element to compare in vector 2
NumElements
Numeric: The number of elements to compare

Examples

compares the second, third and forth elements of two vectors
Variables: myArray( Vector ), myOtherArray( 4, 10 ), result; FillVector( myArray, 8, 4, 4, 4, 1 ); result = CompareVector( myArray, 1, myOtherArray, 1, 3 ); Print( result ); // 0, the elements are the same
Compares two complete vectors
Variables: myArray( Vector ), myOtherArray( 4, 5 ), result; FillVector( myArray, 4, 8, 2, 4, 1 ); result = CompareVector( myArray, myOtherArray ); Print( result ); // 1, the first array is greater