MathGroup Archive 1992

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Outputting x,y pairs in Mathematica

  • To: mathgroup at yoda.physics.unc.edu
  • Subject: Re: Outputting x,y pairs in Mathematica
  • From: David Withoff <withoff>
  • Date: Tue, 3 Mar 1992 13:13:24 -0600

>         I would like Mathematica to do a simple thing for me.  I would
> like to be able to take a list of pairs, e.g., 
> 
>         pairs = {{x1,y1}, {x2,y2},{x3,y3},...{xn,yn}}
> 
> and write it out to a file in the form
> 
>         x1 y1
>         x2 y2
>         x3 y3
>         .....
>         xn yn

Try the TableSpacing option:

In[6]:= pairs = Table[Random[], {5}, {2}];

In[7]:= OutputForm[TableForm[pairs, TableSpacing -> {0, 5}]] >> "file"

In[8]:= !!file
0.490603     0.679651
0.915618     0.278768
0.466052     0.441966
0.253975     0.634225
0.263516     0.785352

Alternatively, Write, WriteString, and other formatting functions can
be used to accomplish the same thing.

Dave Withoff
withoff at wri.com






  • Prev by Date: conference announcement
  • Next by Date: Printing out mathematica graphics
  • Previous by thread: Outputting x,y pairs in Mathematica
  • Next by thread: Mathematica Course