Now I have a list stored in data
as follows
data = {{"Ca", 1, 1, 1}, {"Ca", 2, 2, 2}, {"Ca", 3, 3, 3}}
the TableForm
of data
is of course as follows:
Ca 1 1 1
Ca 2 2 2
Ca 3 3 3
But how to write this TableForm
of data
into a file?
I tried code like
OutputForm[TableForm[data]]>>"test"
But the result is
Ca 1 1 1
Ca 2 2 2
Ca 3 3 3
Why there are blank lines???? How to prevent the emergence of these blank lines when write TableForm expression into a file?
TableSpacing
is more flexible, for example inOpenWrite
andWrite
cases? But there is a problem, the accuracy of the number thatOutputForm
gives is not enough sometimes, do you know other method to solve this? $\endgroup$data = {{"Ca", 1.123456789, 1.98765432}}
, thenOutputForm[TableForm[data, TableSpacing -> {0, 3}]] >> "test"
will giveCa 1.12346 1.98765
, you can see the accuracy is downgrade. But Lou gives addtional answer that suggest usingSetAccuracy
, it works well. What do you think of Lou's method? $\endgroup$WriteString
. $\endgroup$