Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1992

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

Search the Archive

Outputting x,y pairs in Mathematica

  • To: mathgroup at
  • Subject: Outputting x,y pairs in Mathematica
  • From: myers at (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[]).

						Chris Myers
						myers at

P.S. To the Moderator:

	I am on the Mma mailing list as myers at
I have moved and would like my address updated to myers at

  • 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