キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Discussions

Solve problems, and share tips and tricks with other JMP users.
言語を選択 翻訳バーを非表示
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 件の受理された解決策

受理された解決策
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

元の投稿で解決策を見る

1件の返信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

おすすめの記事