Merging 4 matrices to one matrix

I am struggling with the task to merge four matrices as presented below. Since the matrices A-D contain more than just four entries it would be too complex to do it by hand. Is there a simple or clever way to get the result in Mathematica?

A = {{A11,A12},
{A21,A22}}

B = {{B11,B12},
{B21,B22}}

C = {{C11,C12},
{C21,C22}}

D = {{D11,D12},
{D21,D22}}

E = {{A11,B11,A12,B12},
{C11,D11,C12,D12},
{A21,B21,A22,B22},
{C21,D21,C22,D22}}


Max

• Look for Join in the documentation Commented Dec 8, 2019 at 18:44
• I have seen Join in the documentation already, but how can I use it to get the distribution I am looking for? I don't understand this point.
– Max
Commented Dec 8, 2019 at 18:58

Not necessarily optimal, but it works:

a = {{A11, A12}, {A21, A22}};

b = {{B11, B12}, {B21, B22}};

c = {{C11, C12}, {C21, C22}};

d = {{D11, D12}, {D21, D22}};

Flatten[{{a, b}, {c, d}}, {{3, 1}, {4, 2}}]

{{A11, B11, A12, B12},
{C11, D11, C12, D12},
{A21, B21, A22, B22},
{C21, D21, C22, D22}}

a = {{A11, A12}, {A21, A22}};
b = {{B11, B12}, {B21, B22}};
c = {{C11, C12}, {C21, C22}};
d = {{D11, D12}, {D21, D22}};

ArrayFlatten[Transpose[{{a, b}, {c, d}}, {3, 4, 1, 2}]]
(*    {{A11, B11, A12, B12},
{C11, D11, C12, D12},
{A21, B21, A22, B22},
{C21, D21, C22, D22}}    *)


A (probably) very slow but very explicit solution:

a = {{A11, A12}, {A21, A22}};
b = {{B11, B12}, {B21, B22}};
c = {{C11, C12}, {C21, C22}};
d = {{D11, D12}, {D21, D22}};

Riffle[
]

{
{A11, B11, A12, B12},
{C11, D11, C12, D12},
{A21, B21, A22, B22},
{C21, D21, C22, D22}
}

• Thank you all very much :)
– Max
Commented Dec 8, 2019 at 21:13