Concat


Concat(A,B,I,J,K)

Concatenates lists or arrays.

When A and B are 1-D arrays,

Concat(A,B)

returns a list (1-D array) consisting of their elements. This form is often used to concatentate two indexes to obtain the elements for 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 square brackets surrounding the variables. If only two parameters are used, column index is .K.

When A and B are arbitrary arrays, where A has index I and B has index J, then

Concat(A,B,I,J,K)

concatenates (i.e., joins) arrays A and B, with the new result indexed by K. You must provide an index K whose length is the sum of the lengths of I and J. Often the index K is obtained using the first form of concatenate.

(new to 4.1) You can omit the K parameter:

Concat(A,B,I,J)

when you do so, the function creates a new local index named K for the result.

When using the five parameter form, Concat(A,B,I,J,K), the index element values don't impact the result, so it doesn't matter if the elements of K are also elements of I or J, nor does it matter what order the index elements of K appear in. 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,K)

would prepend a column of zeroes to B.

Library

Array functions

Examples

Index In1 := ['a','b','c']
Concat( In1, ['z'] ) &rarry ['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]

See Also

Comments


You are not allowed to post comments.