Description: This statement performs a mathematical operation on an array with respect to another array.
Returns: Nothing
Usage: Script
Format: ArrayOp2(Array1Elem, Array2Elem, N, OpCode)
Parameters: Array1Elem { array element } { required } { no default: }
Any array element giving the starting point for the array operation in the destination array. The subscript for the array may be any numeric expression. Unless specified, the lowest dimension of a multidimensional array is used.
Array2Elem { array element } { required } { no default: }
Any array element giving the starting point for the array operation in the source array. The subscript for the array may be any numeric expression. Unless specified, the lowest dimension of a multidimensional array is used.
N { numeric } { required } { no default: }
Any numeric expression giving the number of array elements to compute. If N extends past the upper bound of the lowest array dimension, this computation will "wrap-around" and resume at element 0, until N elements have been processed.
OpCode { numeric } { required } { no default: }
Any numeric expression giving the operation number to perform as follows (note that A1 is an element of Array1 and A2 is an element of Array2):
|
OpCode |
Operation |
OpCode |
Operation |
|
0 |
A1 = A2 |
17 |
A1 = XOR(A1,A2) |
|
1 |
A1 = A1 + A2 |
18 |
A1 = Pow(A1,A2) |
|
2 |
A1 = A1 - A2 |
19 |
A1 = Exp(A2*A1) |
|
3 |
A1 = A2 - A1 |
20 |
A1 = A2 * Log(A1) |
|
4 |
A1 = A1 * A2 |
21 |
A1 = A2 * Ln(A1) |
|
5 |
A1 = A1 / A2 |
22 |
A1 = Sin(A2 * A1) |
|
6 |
A1 = A2 / A1 |
23 |
A1 = Cos(A2 * A1) |
|
7 |
A1 = A1 % A2 |
24 |
A1 = Tan (A2 * A1) |
|
8 |
A1 = Min(A1,A2) |
25 |
A1 = A2 * ASin(A1) |
|
9 |
A1 = Max(A1,A2) |
26 |
A1 = A2 * ACos(A1) |
|
10 |
A1 = A1 < A2 |
27 |
A1 = A2 * ATan(A1) |
|
11 |
A1 = A1 <= A2 |
28 |
A1 = A2 * Sqrt(A1) |
|
12 |
A1 = A1==A2 |
29 |
A1 = A2 * Abs(A1) |
|
13 |
A1 = A1 >= A2 |
30 |
A1 = (Index of A1) + A2 |
|
14 |
A1 = A1 > A2 |
31 |
A1 = (Index of A1) * A2 |
|
15 |
A1 = AND (A1,A2) |
32 |
A1 = A2 * Round(A1) |
|
16 |
A1 = OR(A1,A2) |
|
|
Comments: The ArrayOp2 statement is useful for large amounts of repetitive computation. While this can be accomplished by executing a script repeatedly using WhileLoop, the ArrayOp2 statement is much faster. Complex computations may be broken down into a series of simple steps and handled by multiple ArrayOp1 and ArrayOp2 statements. If text arrays are used, each text value will be converted to a number before the numerical operations are performed. The resulting array is converted back to text.
Example:
If 1 Main;
[
ArrayOp2(xArray[3] { Starting element in xArray },
yArray[3] { Starting element in yArray },
50 { Perform operation on 50 elements },
4 { xArray element x yArray element });
]
The example above sets each element in xArray to the product of that element with a corresponding element in yArray, beginning at element 3 and ending at element 52. In other words:
xArray[n] = xArray[n] * yArray[n]
for n = 3 to 52.
See Also: