MathGroup Archive 1992

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

Search the Archive

Outputting x,y pairs in Mathematica

  • To: mathgroup at yoda.physics.unc.edu
  • Subject: Outputting x,y pairs in Mathematica
  • From: myers at nsfitp.itp.ucsb.edu (Chris Myers)
  • Date: Sun, 1 Mar 92 22:18:38 PST

To the Mathgroup --

	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

Unfortunately, the closest I have come to this is with

	OutputForm[TableForm[pairs]] >> file,

which gives me the desired result except with an extra carriage return
between lines:

	x1 y1

	x2 y2

	x3 y3

	.....

	xn yn

(For those of us who think that Mathematica does a less-than-spectacular
job in plotting things, writing out {x,y} pairs in the form mentioned 
above is rather useful, so that they can be plotted by some other program.)

Any suggestions would be appreciated.  Elegance is not a requirement,
although I would prefer something that I can stick in a definition
and be done with (e.g., define a new Form such as XYForm[]).

					Thanks,
						Chris Myers
						myers at sbitp.ucsb.edu

P.S. To the Moderator:

	I am on the Mma mailing list as myers at helios.tn.cornell.edu.
I have moved and would like my address updated to myers at sbitp.ucsb.edu.








  • Prev by Date: [no subject]
  • Next by Date: Mathematica Course
  • Previous by thread: [no subject]
  • Next by thread: Re: Outputting x,y pairs in Mathematica