This is literally a follow-up to part of Mr.Wizard's answer to: Plot, extract data to a file
Specifically in reference to
multidat = Cases[First @ gr, Line[data_] :> data, -4];
We could then export each part to a separate file like this:
Export["file" <> IntegerString[#2] <> ".txt", #, "Table"] & ~MapIndexed~ multidat
{"file1.txt", "file2.txt", "file3.txt"}
First, may I please get confirmation that I'm correctly reading the ~
s in the middle line as the infix version of
MapIndexed[Export["file" <> IntegerString[#2] <> ".txt", #, "Table"]&, multidat]
?
Second, is there a simple way to export multidat
into a single file with the lines as pairs of columns? I.e., suppose multidat
is
{{{a1,a2},{b1,b2},{c1,c2}},
{{p1,p2},{q1,q2},{r1,r2},{s1,s2}},
{{x1,x2},{y1,y2},{z1,z2}}}
How would you turn that into
{{a1,a2,p1,p2,x1,x2},
{b1,b2,q1,q2,y1,y2},
{c1,c2,r1,r2,z1,z2}},
{,,s1,s2,,}}
?
Admittedly, I'm not sure how Mma would handle that last row. The data I have in mind is destined for a spreadsheet-like presentation where cells can be empty. Thanks for your help!