# Export multiple lists in table form to the same file

I have a list, call it mylist, made of many sublists that are just points from a plot and I would like to export that to a single file. Let's say I have, for example, something like this

mylist1={{1,2},{3,4}};
mylist2={{5,6},{7,8}};
mylist={mylist1,mylist2};


I need an output file like

1 2
3 4

5 6
7 8


(notice the empty line between the two sublists). If I do

Export["myfile.txt", mylist1, "Table"]


I obtain a file with

1 2
3 4


which is ok for a single sublist, but I don't know what to do in order to export all the sublists to the same file separated by an empty line.

You can combine the matrices into a single matrix, and then export:

combined = Join[mylist1, {{}}, mylist2];

ExportString[combined, "Table"]

1   2
3   4

5   6
7   8


If you have many lists, you can use Riffle and Catenate to join the lists together:

ExportString[Catenate @ Riffle[mylist, {{{}}}], "Table"]

1   2
3   4

5   6
7   8

• Thank you! I did use your second suggestion having multiple sublists with Export["myfile.txt",ExportString[Catenate@Riffle[mylist, {{{}}}], "Table"]] – Emmet Jun 22 '19 at 17:30