Re: Importing data with comma as decimal separator
- To: mathgroup at smc.vnet.net
- Subject: [mg98142] Re: Importing data with comma as decimal separator
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Tue, 31 Mar 2009 04:19:01 -0500 (EST)
On 3/30/09 at 4:43 AM, Domagoj.Pavicic at gmail.com (Dom) wrote:
>I would like to import two-column numerical data in which comma is
>used as decimal separator. The first 12 lines of the file is header,
>followed by two tab-separated columns of numbers. How I can do this
>in Mathematica 6.0? Thanks.
This can be done in Mathematica as follows:
data = ReadList[filename, String][[13;;]];
data = StringSplit[StringReplace[#, ","->"."], "\t"]&/@data;
data = Map[ToExpression, data, {2}];
But, I think it is easier to replace the comma's with periods
using a text editor than using Import to read the file into Mathematica.