I have a feature written below
f(n_, w_Integer /; Positive(w)) := PaddedForm(N(n), {w, w}, NumberPadding -> {"", "0"}, NumberFormat -> (Row({#1, "e", If(#3 == "", "0", #3)}) &));
Then I defined a matrix as
a = ConstantArray(0, {3, 3});
My matrix elements are defined as:
a((1, 1)) = f(3.332567, 4);
a((1, 2)) = f(2.17530, 4);
a((1, 3)) = f(0., 4);
a((2, 1)) = f(2.64254, 4);
a((2, 2)) = f(1.6432, 4);
a((2, 3)) = f(5.2533, 4);
Then I would like to export this matrix into a txt file with the following command
Export("a.txt", a, "Table", "FieldSeperators" -> "")
Instead of getting the formatted numbers in the TXT file, I get the commands in the text file as:
PaddedForm(3.332567, {4, 4}, NumberPadding -> {"", "0"}, NumberFormat -> (Row({#1, "e", If(#3 == "", "0", #3)}) & )) PaddedForm(2.1753, {4, 4}, NumberPadding -> {"", "0"}, NumberFormat -> (Row({#1, "e", If(#3 == "", "0", #3)}) & ))
PaddedForm(0., {4, 4}, NumberPadding -> {"", "0"}, NumberFormat -> (Row({#1, "e", If(#3 == "", "0", #3)}) & ))
PaddedForm(2.64254, {4, 4}, NumberPadding -> {"", "0"}, NumberFormat -> (Row({#1, "e", If(#3 == "", "0", #3)}) & )) PaddedForm(1.6432, {4, 4}, NumberPadding -> {"", "0"}, NumberFormat -> (Row({#1, "e", If(#3 == "", "0", #3)}) & ))
I used a code that reads as follows:
Export("a.txt", OutputForm(a), "Table", "FieldSeperators" -> "")
However, there is not the solution as a table; there is the solution in curly braces that I do not want.
{{3.3330e0, 2.1750e0, 0.0000e0}, {2.6430e0, 1.6430e0, 5.2530e0}, {0, 0, 0}}
How could I solve this problem to get a txt file that stores data in a table format?
Many thanks.