For the latest version of JMP Help, visit JMP.com/help.


Publication date: 06/21/2023

Concatenation Function

The Concat() function combines two matrices side by side to form a larger matrix. The number of rows must agree. A double vertical bar ( || ) is the infix operator, equivalent for horizontal concatenation.

Identity( 2 ) || J( 2, 3, 4 );

[1 0 4 4 4, 0 1 4 4 4]

B = [1, 1];
B || Concat( Identity( 2 ), J( 2, 3, 4 ) );

[1 1 0 4 4 4, 1 0 1 4 4 4]

The VConcat() function stacks two matrices on top of each other to form a larger matrix. The number of columns must agree. A vertical-bar-slash ( |/ ) is the infix operator, equivalent for vertical concatenation.

Identity( 2 ) |/ J( 3, 2, 1 );

// or VConcat( Identity( 2 ),J( 3, 2, 1 ) );

[1 0, 0 1, 1 1, 1 1, 1 1]

Both Concat() and VConcat() support concatenating to empty matrices, scalars, and lists.

a=[];
a || [1]; // returns [1]
a || {2}; // returns [2]
a || [3 4 5]; // returns [3 4 5]

There are two in place concatenation operators: ||= and |/= . They are equivalent to the Concat To() and V Concat To() functions, respectively.

a || = b is equivalent to a = a || b

a |/ = b is equivalent to a = a | /b

Want more information? Have questions? Get answers in the JMP User Community (community.jmp.com).