Concat
Concat(a, b, i, j, k)
Concatenates two lists or arrays to create a single list or array with a longer index.
When A and B are 1-D arrays,
Concat(A, B)
returns a list (1-D array) consisting of their elements. This form is useful to concatenate two indexes to generate a third index.
When A and B are 1-D arrays with a common index
Concat([A], [B])
returns a 2-D array with two columns. Notice the square brackets around each variable. If only two parameters are used, column index is .K.
When A is an array with index I and B is an array with index J,
Concat(A, B, I, J)
concatenates (i.e., joins) arrays A and B, with the new result indexed by local index .K whose values are the concatenation of I and J.
Or you can provide the index K for the result, whose length must be the sum of the lengths of I and J:
Concat(A, B, I, J, K)
When using this five parameter form, the index values of I and J are ignored -- so it doesn't matter if the elements of K
are also elements of I
or J. All that matters is that the number of elements in K
is the number of elements of I
plus the number of elements in J
. The positional ordering of the slices of each array are not altered -- the result consists of all the elements of A
followed by all the elements of B
.
When A
(or B
) is implicitly indexed (for example, if it is a list or a single number), you can omit the index parameter. For example:
Concat([0], B, , J)
prepends a column of zeroes to B
.
Examples
Index In1 := ['a', 'b', 'c']
Concat(In1, ['z']) → ['a', 'b', 'c', 'z']
INDEX I := [1, 2]; INDEX J := ['a', 'b']; INDEX K := Concat(J, 'c'); VAR A := Array( I, J, 1 ); VAR B := Array( I, 2 ); Concat( A, [B], J, , K) Result: a b c 1| [1, 1, 2 2| 1, 1, 2]
Enable comment auto-refresher