Re: Help with formatting output
- To: mathgroup at smc.vnet.net
- Subject: [mg77809] Re: Help with formatting output
- From: "Jean-Marc Gulliet" <jeanmarc.gulliet at gmail.com>
- Date: Sun, 17 Jun 2007 06:07:27 -0400 (EDT)
- References: <200706140922.FAA06668@smc.vnet.net> <f4r5h1$btk$1@smc.vnet.net>
On 6/16/07, Diana Mecum <diana.mecum at gmail.com> wrote: > > Jean-Marc, > > I get: > > Export::noopen : Cannot open C:\myFile.text. messages. > > I have attached the file you sent, after I ran it. > > Diana Mathematica cannot write at the specified location. I work on a PC Intel Windows XP computer and the syntax for the path to the file is correct in this specific environment. Now, either you work also on a PC system and you do not have the permissions to create a new file directly under the top level of the disk C, or you work on a Mac or Linux/Unix system and the syntax above is not the correct one. So, change the file name to a directory/folder in which you have write access. Or use a file name without any directory/folder specification to use the default one provided by your system. I have uploaded an updated notebook at http://homepages.nyu.edu/~jmg336/mathematica/DianaExportOutput.nb that identifies the Mathematica version and platform in use, and also the file name use the default settings from your system. Regards, Jean-Marc On 6/15/07, Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com> wrote: > > > > 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. > > > > > > > > > -- > "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>
- Help with formatting output