MathGroup Archive 2002

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

Search the Archive

Re: How to export plain text numbers!?


Hi Soxos,

You can use

Export["file.dat", expr] where expr is a two-dimensional array.

Or for more flexibility study the following.

Assuming data has n rows and 2 columns.

file = OpenWrite["file.dat"];
Map[
   (
      (* the N may be redundant haven't tested the
         code w/o it *)
      str = ToString[PaddedForm[N[#[[1]]],{10,6}]]<>"   "<>
            ToString[PaddedForm[N[#[[2]]],{10,6}]];

      (* make numbers e notation:
         the *^ notation has given me fits, so I just put this
         in as a precaution *)
      str = StringReplace[str, "*^" -> "e"];
      WriteString[file, str, "\n"]
   )&, data];

Close[file]


Hope this helps,
Lawrence


Soxos wrote:
> Hi,
> I'm trying to export a table from Mathematica 4.0 to Notepad, for examples,
> or something similar, but it's impossible for me! It always exports the cell
> with all its "rubbish", or an image (if I use Word).
> How can I export just plain _numbers_?
> 
> Thanx
> Fip
> 
> 


-- 
Lawrence A. Walker Jr.
http://www.kingshonor.com


  • Prev by Date: Exporting Fonts Mathematica 4.2 Linux
  • Next by Date: A Bessel integral
  • Previous by thread: Re: How to export plain text numbers!?
  • Next by thread: Question KeyEventTranslation