Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1997

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

Search the Archive

Re: How to output matrix to file

  • To: mathgroup at
  • To: mathgroup at
  • Subject: [mg7424] Re: How to output matrix to file
  • From: "H.J. Wang" <hungjen at>
  • Date: Sat, 31 May 1997 15:07:43 -0400 (EDT)
  • Organization: University of Michigan
  • Sender: owner-wri-mathgroup at

David Brienza wrote:
> How can I export a 2D matrix to a tab delimited text file? I've tried:
> OutputForm[datamatrix] >> datafile.dat
> Which gives me files with unwanted linefeeds in the middle of the rows. I

> -Dave Brienza

Try the following:

define = OpenWrite[ savefilename,FormatType->OutputForm,
Write[ define, TableForm[ dataset, TableSpacing->{0} ] ] ;
Close[ define];

If the matrix has many columns, the PageWidth->Infinity makes sure the
rows of the matrix won't be wrapped in the output.

Hope it helps.

H.J. Wang

  • Prev by Date: Re: Get answers out of listform
  • Next by Date: Fwd: List manipulation
  • Previous by thread: Re: Get answers out of listform
  • Next by thread: Re: variable declarations in mathematica?