cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • JMP will suspend normal business operations for our Winter Holiday beginning on Wednesday, Dec. 24, 2025, at 5:00 p.m. ET (2:00 p.m. ET for JMP Accounts Receivable).
    Regular business hours will resume at 9:00 a.m. EST on Friday, Jan. 2, 2026.
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
lala
Level IX

How to concatenate identical matrices in memory?

Hello!

 

For example, how to concatenate the two matrices:

mat1=[1.05 0.17 1.64 ., 2.06 0.81 0.63 ., 0.23 1.87 1.24 -8, 0.72 0.42 0.43 -8, 0.59 0.17 0.67 -8];

mat2=[2.78 0 0.59 -8, 1.85 . 1.24 -8, 1.19 0.86 0.75 8]
1 ACCEPTED SOLUTION

Accepted Solutions
Craige_Hales
Super User

Re: How to concatenate identical matrices in memory?

You'll use the vertical concatenation operator since they have the same number of columns.

mat1 = [1.05 0.17 1.64 .,
2.06 0.81 0.63 .,
0.23 1.87 1.24 -8,
0.72 0.42 0.43 -8,
0.59 0.17 0.67 -8];

mat2 = [2.78 0 0.59 -8,
1.85 . 1.24 -8,
1.19 0.86 0.75 8];

result = mat1 |/ mat2;

show( mat1, mat2, result );

/*
mat1 = 
[	1.05 0.17 1.64 ., 
	2.06 0.81 0.63 ., 
	0.23 1.87 1.24 -8, 
	0.72 0.42 0.43 -8, 
	0.59 0.17 0.67 -8];
mat2 = 
[	2.78 0 0.59 -8, 
	1.85 . 1.24 -8, 
	1.19 0.86 0.75 8];
result = 
[	1.05 0.17 1.64 ., 
	2.06 0.81 0.63 ., 
	0.23 1.87 1.24 -8, 
	0.72 0.42 0.43 -8, 
	0.59 0.17 0.67 -8, 
	2.78 0 0.59 -8, 
	1.85 . 1.24 -8, 
	1.19 0.86 0.75 8];
*/

|/ is vertical, || is horizontal, but you have different number of rows, so horizontal will not work.

Craige

View solution in original post

1 REPLY 1
Craige_Hales
Super User

Re: How to concatenate identical matrices in memory?

You'll use the vertical concatenation operator since they have the same number of columns.

mat1 = [1.05 0.17 1.64 .,
2.06 0.81 0.63 .,
0.23 1.87 1.24 -8,
0.72 0.42 0.43 -8,
0.59 0.17 0.67 -8];

mat2 = [2.78 0 0.59 -8,
1.85 . 1.24 -8,
1.19 0.86 0.75 8];

result = mat1 |/ mat2;

show( mat1, mat2, result );

/*
mat1 = 
[	1.05 0.17 1.64 ., 
	2.06 0.81 0.63 ., 
	0.23 1.87 1.24 -8, 
	0.72 0.42 0.43 -8, 
	0.59 0.17 0.67 -8];
mat2 = 
[	2.78 0 0.59 -8, 
	1.85 . 1.24 -8, 
	1.19 0.86 0.75 8];
result = 
[	1.05 0.17 1.64 ., 
	2.06 0.81 0.63 ., 
	0.23 1.87 1.24 -8, 
	0.72 0.42 0.43 -8, 
	0.59 0.17 0.67 -8, 
	2.78 0 0.59 -8, 
	1.85 . 1.24 -8, 
	1.19 0.86 0.75 8];
*/

|/ is vertical, || is horizontal, but you have different number of rows, so horizontal will not work.

Craige

Recommended Articles