WriteList function?
- To: mathgroup at smc.vnet.net
- Subject: [mg9320] WriteList function?
- From: tthomas at ibmoto.com (Tom Thomas)
- Date: Mon, 27 Oct 1997 02:47:36 -0500
- Organization: IBM/Motorola Somerset PowerPC Design Center
- Sender: owner-wri-mathgroup at wolfram.com
Hi, I am a new Mathematica user. I have had success reading files of space-separated numbers using ReadList, but now need to output my results in the same fashion. i.e. one row of the matrix should appear on one text line, no commas, nor curly braces are desired in the output. I have searched the manual for a corresponding WriteList function without success. Any suggestions? I may have to resort to awk/sed/perl to postprocess the file, but I would've thought Mathematica would've provided the facilities to write data in a general format. Thank you kindly, --tom thomas ------------------------------------------------------------------- example: In[1]:= !! /tmp/mymat 1 2 3 4 5 6 7 8 9 In[1]:= mydata = ReadList["/tmp/mymat", Number, RecordLists->True] Out[1]= {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}} In[2]:= stmp = OpenWrite["/tmp/myoutput"] Out[2]= OutputStream[/tmp/myoutput, 4] In[3]:= Write[stmp, mydata] %cat /tmp/myoutput {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}} I need to see instead: 1 2 3 4 5 6 7 8 9