# Cast 4-dimensional array to square matrix [closed]

Suppose that $T$ is an array with dimensions

dimensions(T)
{2, 2, m, m}


## closed as off-topic by MarcoB, Sascha, Feyre, Niki Estner, corey979Jan 31 '17 at 13:09

This question appears to be off-topic. The users who voted to close gave these specific reasons:

• "This question cannot be answered without additional information. Questions on problems in code must describe the specific problem and include valid code to reproduce it. Any data used for programming examples should be embedded in the question or code to generate the (fake) data must be included." – MarcoB, Sascha, corey979
• "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Feyre, Niki Estner
If this question can be reworded to fit the rules in the help center, please edit the question.

• For moderators: I'm using a picture instead of latex because I was receiving the error Post appears to contain code that is not properly formatted.... It seems that some of the displayed equations are somehow (mis)interpreted as malformed code (see for instance here). – bbn Jan 30 '17 at 16:37
• Can you add code for any attempts you have made at solving this problem? – MarcoB Jan 30 '17 at 16:38
• I think ArrayFlatten will do this, immediately... – march Jan 30 '17 at 16:39
• A minimal example with the large 4D matrix and desired output matrix would help in providing a solution. – Jack LaVigne Jan 30 '17 at 17:00

As @march pointed out in a comment, this is exactly what ArrayFlatten is for. Here's an example:
s = Function[x, Array[Subscript[x, ##] &, {3, 3}]];