MathGroup Archive 1999

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

Search the Archive

Re: writing mathematica data to a tab delimited file??

  • To: mathgroup at smc.vnet.net
  • Subject: [mg18340] Re: writing mathematica data to a tab delimited file??
  • From: tburton at brahea.com (Tom Burton)
  • Date: Wed, 30 Jun 1999 14:13:15 -0400
  • Organization: Brahea, Inc.
  • References: <7l5t26$il6@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

There's lots on this topic in books, in MathSource, and elsewhere. I
have been using this function:

Options[tabDelimitedForm]=PageWidth\[Rule]132;

tabDelimitedForm[x:{{__}..},opts___?OptionQ]:=
	Module[{
			PageWidthRule=Options[$Output,PageWidth],
			TableDirectionsRule=Options[TableForm,TableDirections],
			thisPageWidth,result},

thisPageWidth=PageWidth/.Flatten[{opts}]/.Options[tabDelimitedForm];
		SetOptions[$Output,PageWidth\[Rule]thisPageWidth];
		SetOptions[TableForm,TableDirections\[Rule]{Column,Row}];
		result=OutputForm[

TableForm[Drop[Flatten[#,1],1]&/@Map[{"\t",FortranForm[#]}&,x,{2}],
          TableSpacing\[Rule]{0,0}]];SetOptions[$Output,PageWidthRule];
    SetOptions[TableForm,TableDirectionsRule];
		result
	]

This function accepts a list of lists. The resulting text can be pasted
to a text file or spreadsheet.  (Use standard Copy, not Copy as Text.
Copy only the text, not the entire output cell.)

The new Export facility in version 4 write directly to a file. I haven't
tried it yet.

Cheers,

Tom Burton


On 27 Jun 1999 15:12:06 -0400, in comp.soft-sys.math.mathematica you
wrote:

>I frequently read data into mathematica that has been given to me as a
>two column tab delimited text file.  Is their some way of saving a
>mathematica list eg.
>
>mylist=Table[{1, x}, {x, 1, 10, 1}]
>
>
>as a file in a tab delimited two column format
>
>1	1
>1	2
>1	3
>1	4 ...
Tom Burton


  • Prev by Date: Re: System of equations
  • Next by Date: Re: Need just enough underbars
  • Previous by thread: Re: writing mathematica data to a tab delimited file??
  • Next by thread: Re: writing mathematica data to a tab delimited file??