Support

Equilla Formula Language

CompareArray

Compares the elements in one array to those in another array. Returns 0 if they are equal, -1 if the first difference in the first array is less than the same element in the second element, and 1 if the first different element is greater. -2 is returned if the parameters are invalid.

Inputs

Array1
Array: The first array to compare.
Start1
Numeric: The index of the first element to compare from Array1.
Array2
Array: The second array to comapre.
Start2
Numeric: The index of the first element to compare from Array2.
NumElements
Numeric: The number of elements to compare.

Examples

Compare the second, third and fourth elements of two vectors
Variable: result; Arrays: myArray[], myOtherArray[]; FillArray(myArray, 8, 4, 4, 4, 1); FillArray(myOtherArray, 2, 4, 4, 4, 23, 3); result = CompareArray(myArray, 2, myOtherArray, 2, 3); print(result); // prints 0, elements are the same
Compare two complete arrays
Variable: result; Arrays: myArray[], myOtherArray[]; FillArray(myArray, 8, 4, 4, 4, 1); FillArray(myOtherArray, 2, 4, 4, 4, 23); result = CompareArray(myArray, myOtherArray); print(result); // prints 1, first array is greater