Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #15479
| From | "Dr. Wolfgang Hintze" <weh@snafu.de> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: Writing numeric data to CSV does not write final EOL |
| Date | 2013-09-20 11:03 +0000 |
| Message-ID | <l1ha2m$t90$1@smc.vnet.net> (permalink) |
| References | <ksg5i0$c0v$1@smc.vnet.net> |
| Organization | Time-Warner Telecom |
Am Sonntag, 21. Juli 2013 10:19:12 UTC+2 schrieb Clark Kogan:
> Hi!
>
>
>
> I am using Mathematica 8 to write a numeric matrix to a csv file using the commands:
>
>
>
> mytable = {{1, 2}, {3, 4}};
>
> mytable = Export["C:/tmpfile.csv", mytable, "csv"];
>
>
>
>
>
> This produces a file, but does not put a final line end character after the 4. I am trying to read this file with R, which requires the final line end character. I was wondering if anyone knew the simplest (or a very simple) way to add the additional line end character.
>
>
>
> Thanks!
>
>
>
> Clark
After correcting the commands for Windows
mytable = {{1, 2}, {3, 4}};
mytable = Export["C:\\temp\\tmpfile.csv", mytable, "csv"];
this works fine.
I can open the csv in Excel, or in Notepad, without problems although, as you said, the Hexdump Shows the Content 312C 320D 0A33 2C34, i.e. without a final 0D0A.
But, if you wish you can easily achieve what you want by appending an empty list, like this
mytableEOF = {{1, 2}, {3, 4},{}};
Best regards,
Wolfgang
Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Find similar
Writing numeric data to CSV does not write final EOL kogan.clark@gmail.com - 2013-07-21 08:19 +0000 Re: Writing numeric data to CSV does not write final EOL "Dr. Wolfgang Hintze" <weh@snafu.de> - 2013-09-20 11:03 +0000
csiph-web