I have a function which is 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 have 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 using the command below which is as
Export["a.txt", a, "Table", "FieldSeperators" -> ""]
Instead of obtaining 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 have used a code which is as:
Export["a.txt", OutputForm[a], "Table", "FieldSeperators" -> ""]
However it does not give the solution as table; it gives the solution in curly brackets which I don't want.
{{3.3330e0, 2.1750e0, 0.0000e0}, {2.6430e0, 1.6430e0, 5.2530e0}, {0, 0, 0}}
How could I solve this problem to obtain a txt file which stores data in a table format ?
Thank you.