I would like to format numbers of a list and write them in columns to file.
list = {{1, 2}, {3, 4}, {5, 6}};
dir = NotebookDirectory[];
Export[StringJoin[dir, "list1.dat"], list, "Table"];
The content of file list1.dat is (a single line):
1 2
3 4
5 6
When the numbers are formatted:
Export[StringJoin[dir, "list2.dat"], NumberForm[list, {5, 4}], "Table"];
The content of file list2.dat is:
{{1.0000, 2.0000}, {3.0000, 4.0000}, {5.0000, 6.0000}}
How can I get the content of list2.dat to be?:
1.0000 2.0000
3.0000 4.0000
5.0000 6.0000
UPDATE:
What would be the solution for:
list = {{{1, 2}, {3, 4}}, {{5, 6}, {7, 8}}}
to get with same formatting:
1.0000 2.0000 3.0000 4.0000
5.0000 6.0000 7.0000 8.0000

Map[NumberForm[#, {5, 4}] &, list, {2}]? – Kuba May 31 '16 at 11:40Join @@@ {{{1, 2}, {3, 4}}, {{5, 6}, {7, 8}}}first. – Kuba May 31 '16 at 12:50