MathGroup Archive 2007

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

Search the Archive

Re: Re: Re: Help needed with new Export (v. 6)

Although this works if the original data is a table, it will not if the 
data is an unnested list, for in that case the items are still written 
with one per line, i.e., each item is treated as a separate record.  For 

   x = Table[RandomReal[], {5}];
   Export["numbers.txt", x, "Table", "FieldSeparators" -> " "]

(You can see the one-number-per-line in the written file, too.)

The fix in this case is:

           "FieldSeparators"->" "]

Carl Woll wrote:
> C.O. wrote:
>> ...Is there now a way to use "Export" to
>> write a list of numbers to a file which has, say, spaces as delimeters
>> rather than tabs (as in TSV) or commas (as in CSV)? I was able to do
>> it easily in version 5, without doing any string manipulation....

> Perhaps you can use:
> Export[file, data, "Table", "FieldSeparators" -> " "]
> Carl Woll
> Wolfram Research
>> On Nov 15, 3:44 am, Curtis Osterhoudt <c... at> wrote:
>>>   In v. 5, I used a Mathematica function to import .fig files, do some
>>> manipulation to them, and then export the files again. The only way I could
>>> find to retain the proper formatting of the .fig files was to use the
>>> ConversionOptions option in Export; the relevant part of the code is
>>> something like:
>>> Export[ newFileName,  myNewExpression, "CSV",
>>> ConversionOptions->{"FieldSeparator" -> " "}]
>>> where "CSV" was used because it somehow keptXFighappy with the results, and
>>> the commas are replaced with spaces. "Table" does not work as an export
>>> format, asXFigneeds single spaces between most of the exported values.
>>>   It seems that the new version of Mathematica does not like
>>> ConversionOptions, as the Help entry says "As of Version 6.0,
>>> ConversionOptions is superseded by capabilities in Import and Export."
>>>   However, I can't figure out what new capabilities might replace my old
>>> behavior. Is there a quick way to fix my old function, or am I going to have
>>> to go through the stream operation tango?

Murray Eisenberg                     murray at
Mathematics & Statistics Dept.
Lederle Graduate Research Tower      phone 413 549-1020 (H)
University of Massachusetts                413 545-2859 (W)
710 North Pleasant Street            fax   413 545-1801
Amherst, MA 01003-9305

  • Prev by Date: Also guide page is needed RE: Mathematica 6 Documentation - how does one add to it?
  • Next by Date: Re: Returning a local array
  • Previous by thread: Re: Re: Help needed with new Export (v. 6)
  • Next by thread: Re: Help needed with new Export (v. 6)