3
$\begingroup$

I've created a table of data in Mathematica with a list of values with each data point. So for example, I have the following dummy data:

data = { {1 , {{1, 2}, {3, 4}, {5, 6}, {7, 8}}}, {2 , {{1, 2}, {3, 
     4}, {5, 6}, {7, 8}}}}

This turns into

data1 = TableForm[data]

    1   2
1   3   4
    5   6
    7   8

    1   2
2   3   4
    5   6
    7   8

When I export this as an excel file using the Export command, I get my initial data back (ie; the first cell is 1, the cell next to it is {{1, 2}, {3, 4}, {5, 6}, {7, 8}}}. I want my excel file to look similar to the table form, so I can import it into a Latex document. What's the best way to do this? Is it possible/easy?

$\endgroup$

1 Answer 1

2
$\begingroup$

Turn your data into a rectangular table:

data2 = Join @@@ Join @@ Transpose /@ MapAt[List /@ {#, "", "", ""} &, data, {All, 1}];

Export["tst.xls", data2]

enter image description here

$\endgroup$
1
  • $\begingroup$ Thank you so much!! $\endgroup$
    – Pineapple
    Aug 16, 2019 at 7:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.