# How to generate table without comma and bracket or get rid of those?

I want just data without comma and brackets. Even TableForm is not working for me. For example, the general pattern of my table is

t = Table[Table[{m, n}, {m, 1, 10}], {n, 1, 9}]


which gives output in the for {x1,y1},{x2,y2}..... . If I use TableForm it will show output as:

1 2 3  ... 10
1...........
...............
2...Numbers......
..............
9............9


But I want output of just two columns for the values of m and n ({m,n}) like

m1 m2
m3 m4
.....


How to do that? Or suggest me how convert the data in the form {{x1,y1},{x2,y2}} in just two columns?

• You've seen Grid[]? Jul 23, 2012 at 12:04
• Apart from the fine answers you've already gotten: Flatten[Outer[Composition[Reverse, List], Range[5], Range[6]], 1] // Grid Jul 23, 2012 at 12:35
• My answer was intended to be complementary to acl's. The actual method in both answers is to use Grid after merging the top level of the array (with either Faltten or Join), and he posted first. I am glad that you liked my answer but I would prefer that you accept his. This is by no means required and you are always at liberty to Accept whatever answer you choose; it is simply my request. Jul 24, 2012 at 8:32

Join @@ Array[{#2, #} &, {5, 6}] // Grid

Tuples@Range@{5, 6} ~Reverse~ {2} // Grid

• Or Join @@ Transpose[Array[List, {6, 5}]] // Grid Jul 23, 2012 at 12:29
t = Table[Table[{m, n}, {m, 1, 6}], {n, 1, 5}];
Flatten[t, 1] // Grid


• Some compaction can be done: t = Table[{m, n}, {n, 1, 5}, {m, 1, 6}];. Jul 23, 2012 at 12:09
• @J.M. & acl You both beat me by a few seconds - with the answer and the comment ;-) Jul 23, 2012 at 12:12
• @acl how can I export this grid to a .txt file. I need the data without the comas and bracets in the .txt file. May 9, 2018 at 15:03

Maybe Flatten should work. If you have, e.g. a List like {{a, b}, {c, {d}, e}, {f, {g, h}}}, as a result of a Table[] or something else, using Flatten[{{a, b}, {c, {d}, e}, {f, {g, h}}}] you obtain {a, b, c, d, e, f, g, h}.