2
$\begingroup$

I wish to update my question. Based off the answer provided, I tried ArrayFlatten for the following: 𝐴 is a 4x2 matrix, 𝐵 is a 4x4 matrix, and 𝐶 is a 4x6 matrix. I tried this to construct a 4x12 matrix: X = ArrayFlatten[{A,B,C}] However, Dimensions[X] returns 3x4 in my notebook instead of 4x12. What I'm really trying to do is to join the matrices together.

How to do this in Mathematica?

Please help. Thanks.

$\endgroup$
2
$\begingroup$

Mind the syntax: ArrayFlatten always wants a matrix of matrices as input.

a = RandomReal[{-1, 1}, {4, 2}];
b = RandomReal[{-1, 1}, {4, 4}];
c = RandomReal[{-1, 1}, {4, 6}];
m = ArrayFlatten[{{a, b, c}}];
m // Dimensions

{4, 12}

$\endgroup$
  • $\begingroup$ Ok thank you. That works $\endgroup$ – D.B. May 30 '19 at 21:02
  • $\begingroup$ You're welcome. $\endgroup$ – Henrik Schumacher May 30 '19 at 21:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.