Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #8738
| From | "Alexey Popkov" <lehin.p@gmail.com> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Error in ExportString[list,"TSV"]? |
| Date | 2012-02-25 06:59 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <jia0s9$1d4$1@smc.vnet.net> (permalink) |
Hello,
Consider the following:
In[29]:= ExportString[{{1},{2}},"TSV"]
%//InputForm
Out[29]= 1
2
Out[30]//InputForm=
"1\r\n2"
One can see that the resulting String expression contains two line breaks
because it has two "newline" characters "\r" and "\n" instead of one
character "\n". This is because the temporary file is readed backward with
the option BinaryFormat->True:
In[34]:=
Cases[Trace@ExportString[{{1},{2}},"TSV"],e_OpenRead:>HoldForm[e],Infinity]//Last
Out[34]=
OpenRead[C:\WINDOWS\Temp\m-dad7b158-e2f5-4e25-9b27-da1f483eb68a,BinaryFormat->True]
The documentation says that BinaryFormat->True "specifies that a stream
should be opened in binary format, so that no textual interpretation of
newlines or other data is done." But the TSV format is a textual, not binary
format!
I am using CopyToClipboard@Cell[ExportString[2Dlist, "TSV"]] for copying 2D
lists of real values from Mathematica and pasting them to an Excel
spreadsheet. But the contents of clipboard differs from the one generated by
Exporting 2Dlist to a TSV text file and then copying its contents to
clipboard via Notepad (the latter does not add unnecessary line breaks)! I
think this is at least an inconsistency, it not it?
Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread
Error in ExportString[list,"TSV"]? "Alexey Popkov" <lehin.p@gmail.com> - 2012-02-25 06:59 +0000
csiph-web