Re: Help with formatting output

*To*: mathgroup at smc.vnet.net*Subject*: [mg77753] Re: Help with formatting output*From*: "Jean-Marc Gulliet" <jeanmarc.gulliet at gmail.com>*Date*: Sat, 16 Jun 2007 03:23:50 -0400 (EDT)*References*: <200706140922.FAA06668@smc.vnet.net> <f4r5h1$btk$1@smc.vnet.net>

On 6/15/07, Diana Mecum <diana.mecum at gmail.com> wrote: > Jean-Marc, > > Thank you. I want the output exported to a text file. > > I have posted a reply to the newsgroup, but there is a delay. > > I am not seeing the output file. I have attached my resulting Mathematica > file to this e-mail. > > Can you tell why it is not working? > > Diana M. Loading your notebook, I have realized you work with Mathematica 5.1; however, the function *FilePrint* is a new function available since version 6.0. So you can try the escape sequence as in the cell In[3] or use a text editor (especially if the real file is quite large). In[1]:= lst = {35, 36, 2, 4, 5}; Export["C:\\myFile.txt", MapIndexed[StringJoin[ToString[#2[[1]]], " ", ToString[#1]] & , lst], "Lines"] Out[2]= C:\myFile.txt In[3]:= !!"C:\\myFile.txt" >From In[3]:= 1 35 2 36 3 2 4 4 5 5 In[4]:= (* For Mathematica 6.0 and above only *) FilePrint["C:\\myFile.txt"] Out[5]= FilePrint[C:\myFile.txt] Regards, Jean-Marc P.S. I have sent privately the corrected notebook by email. > On 6/15/07, Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com > wrote: > > Diana wrote: > > > Tim, > > > > > > Thanks. Can you suggest a way to convert the two column output of this > > > command to a text file, and eliminate the extra formatting characters? > > > > > > Diana > > > > What you need in this case is the *Export* function with some tweaking > > to get a text file in which the columns are separated by only /one/ space. > > > > In[1]:= lst = {35, 36, 2, 4, 5}; > > Export["myFile.txt", > MapIndexed[StringJoin[ToString[#2[[1]]], " ", > > ToString[#1]] & , lst], "Lines"] > > FilePrint[%] > > > > Out[2]= " myFile.txt" > > > > During evaluation of In[1]:= > > 1 35 > > 2 36 > > 3 2 > > 4 4 > > 5 5 > > > > Regards, > > Jean-Marc > > > > > > -- > "God made the integers, all else is the work of man." > L. Kronecker, Jahresber. DMV 2, S. 19. >

**References**:**Help with formatting output***From:*Diana <diana.mecum@gmail.com>