Question: writedata (on a single line)

have a list of lists, and I would like to write each of these lists on a separate file, *on a single line*.

For instance consider the following trivial example:

P := [[-.3819660120, .6180339880, -10000, -2], [.6180339880, 1.618033988, -10000, -1], [1.618033988, 10000, -10000, -.5], [2.618033988, 10000, -.5, -0.1e-3], [2.618033988, 10000, 0.1e-3, .5]]

I would like to create
 + a file named  P1.dat containing the line
      -.3819660120, .6180339880, -10000, -2
 + a file named  P2.dat containing the line
   .6180339880, 1.618033988, -10000, -1
 + etc.

My first naive attempt was the following:
######################################
for j from 1 to 5 do
writedata(cat("P",j,".dat"),op(j,P)):
od;
######################################

but it puts the data in column (and not on the same line).

Any idea? Thanks!

 

Please Wait...