Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.



Re: How to output matrix to file
Posted:
May 31, 1997 3:29 PM


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, PageWidth>Infinity]; 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



