MathGroup Archive 1998

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

Search the Archive

Re: writing to a file



I have just been trying the same thing, here is what I found (after
three hours! Am I stupid or Mathematica?):

if your data is in a mathematical List, such as  mylist={{1, 4, 0.4},
{2, 5, 0.6}, {3, 6, 0.8}} then do the following

file=OpenWrite["foo.dat"]
WriteString[file, TableForm[mylist]] Close[file]

This should do it.

On 31 Dec 1997 lichtner@swri.edu wrote:

> Date: 31 Dec 1997 02:40:14 -0500
> From: lichtner@swri.edu
To: mathgroup@smc.vnet.net
> Newsgroups: comp.soft-sys.math.mathematica
> Subject: [mg10264] writing to a file
> 
> I am using Mathematica 3.0.0 running under NeXTSTEP 3.3. I would like to
> be able to write a sequence of numbers to a file formatted so that the
> numbers are separated by e.g. spaces. For example:
> 
> 0.01  0.000846  0.000641
> 0.02  0.000827  0.000864
> 0.03  0.000851  0.000944
> 0.04  0.000881  0.000974
> etc.
> 
> I find that with the new version of Mathematica that Print does not work
> because each row is enclosed in a cell. I have not been able to get
> Write to insert spaces between numbers in a row---which I would think
> must be rather trivial. Any help would be greatly appreciated. ...Peter
> __________________________________________________________________ Peter
> C. Lichtner	<lichtner@swri.edu> Southwest Research
> Institute		http://www.swri.edu/ Center for Nuclear Waste Regulatory
> Analyses (CNWRA) 6220 Culebra Road		
> San Antonio, Texas  78238-5166
> Telephone:	Work:	(210) 522-6084	<<NeXTMail Welcome!!!>>
> 			Fax: 	(210) 522-6081
> __________________________________________________________________
> 
> 
> 

Xuelei Chen

-------------------------------------------------------------------------
email: xuelei@phys.columbia.edu 
Homepage: http://phys.columbia.edu/~xuelei Telephone:
212-854-3801(physics), 212-854-6865(astro), 212-749-8836(home)
-------------------------------------------------------------------------
			      
			      
			      
			      
			      
			      




  • Prev by Date: Re: writing to a file
  • Next by Date: Re: Packages for Feynman Diagrams
  • Prev by thread: Re: writing to a file
  • Next by thread: Together and Simplify