My question is how to turn a 4-level matrix (notice one extra level)
A = {{{{1, 2, 3}, {4, 5, 6}}}, {{{7, 8, 9}, {10, 11, 12}}}};
into the following:
B = {{{1, 2, 3}, {4, 5, 6}}, {{7, 8, 9}, {10, 11, 12}}};
I think Flatten might do the job but I was unable to understand how it works, especially with these matrix second argument.
So a more general question: is there a way to detect extra levels and eliminate them all together?
I am using Mathematica 10.4.1
B = Flatten[A, 1]orB = Join @@ Aworks. – JungHwan Min Aug 01 '16 at 23:06Flattenby itself removes allLists. The second argument specifies which level it should remove. (e.g.2removes two enclosingLists). If you put a list or a matrix in the second argument, itFlattens those levels only. Here is a good explanation on that: (119). – JungHwan Min Aug 01 '16 at 23:16B = First /@ A– Bob Hanlon Aug 02 '16 at 00:23