Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Is there a rule that tells Mathematica to set a semicolon at the end of each line (except of the last one)?

My MWE is:

Export["..\\Thesis\\Hamiltonian_stark.dat",Table[j + 10 i, {i, 0, 9}, {j, 0, 9}]]

But I want something like

Export["..\\Thesis\\Hamiltonian_stark.dat",Table[j + 10 i, {i, 0, 9}, {j, 0, 9}],{EndOfLine->';/n'}]
share|improve this question

1 Answer 1

up vote 10 down vote accepted

How about:

Export["t.txt", Table[j + 10 i, {i, 0, 9}, {j, 0, 9}], 
 "List", 
 "LineSeparators" -> ";\n"]
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
{10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
{20, 21, 22, 23, 24, 25, 26, 27, 28, 29};
{30, 31, 32, 33, 34, 35, 36, 37, 38, 39};
{40, 41, 42, 43, 44, 45, 46, 47, 48, 49};
{50, 51, 52, 53, 54, 55, 56, 57, 58, 59};
{60, 61, 62, 63, 64, 65, 66, 67, 68, 69};
{70, 71, 72, 73, 74, 75, 76, 77, 78, 79};
{80, 81, 82, 83, 84, 85, 86, 87, 88, 89};
{90, 91, 92, 93, 94, 95, 96, 97, 98, 99}

If you should happen to want a different format, try this:

Export["t.txt", Table[j + 10 i, {i, 0, 9}, {j, 0, 9}], "Table", 
 "LineSeparators" -> ";\n"]
 0  1   2   3   4   5   6   7   8   9;
10  11  12  13  14  15  16  17  18  19;
20  21  22  23  24  25  26  27  28  29;
30  31  32  33  34  35  36  37  38  39;
40  41  42  43  44  45  46  47  48  49;
50  51  52  53  54  55  56  57  58  59;
60  61  62  63  64  65  66  67  68  69;
70  71  72  73  74  75  76  77  78  79;
80  81  82  83  84  85  86  87  88  89;
90  91  92  93  94  95  96  97  98  99
share|improve this answer
    
But to use the data, I want to omit the brackets. –  strpeter Jun 26 '13 at 16:20
    
@strpeter you should have said ...:) –  cormullion Jun 26 '13 at 16:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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