Re: Trying to export two column table to text file
- To: mathgroup at smc.vnet.net
- Subject: [mg77830] Re: [mg77819] Trying to export two column table to text file
- From: "Igor C. Antonio" <igora at wolf-ram.com>
- Date: Mon, 18 Jun 2007 06:49:41 -0400 (EDT)
- Organization: Wolfram Research, Inc.
- References: <200706171012.GAA02026@smc.vnet.net>
- Reply-to: igora at wolf-ram.com
Diana wrote: > All, > > I am trying to convert a list of numbers, such as: > > {4, 5, 10, 11, 3, 79, ...} > > to a two column text file such as: > > 1 4 > 2 5 > 3 10 > 4 11 > 5 3 > 6 79 ... > > Let me use the following example. Assume that I have defined an > "r[n_]" function of arbitrary integers. > > tt = Flatten[Prepend[Table[Numerator[r[n]], {n, 4, 100}], {1, 1, 5}]] > > tttable = Table[{j, tt[[j]]}, {j, 1, Length[tt]}] > > Export["sequence.txt", tttable] > > I get an output line of "sequence.txt", but then can not find the > file. > > I am using Windows Vista, and believe I am searching the whole > computer. > > Diana M. > Diana, files are, by default, placed in Directory[]. To export to a two column text file, create a n x 2 table first. In[1]:= lst = {4, 5, 10, 11, 3, 79}; In[3]:= Export["file.txt", Partition[lst, 2], "Table"]; In[4]:= Directory[] Out[4]= "D:\\Documents" Note that Parition will drop nonpairs, in this case. See documentation for Partition for more complex cases. Igor C. Antonio Wolfram Research, Inc. -- To email me personally, remove the dash.
- References:
- Trying to export two column table to text file
- From: Diana <diana.mecum@gmail.com>
- Trying to export two column table to text file