Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Textread
Date: Wed, 1 Jul 2009 18:53:01 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 38
Message-ID: <h2gbad$3rj$1@fred.mathworks.com>
References: <h2favd$6b6$1@fred.mathworks.com> <op.uwd76lf8a5ziv5@uthamaa.dhcp.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1246474381 3955 172.30.248.37 (1 Jul 2009 18:53:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 1 Jul 2009 18:53:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1893295
Xref: news.mathworks.com comp.soft-sys.matlab:552132


"Ashish Uthama" <first.last@mathworks.com> wrote in message <op.uwd76lf8a5ziv5@uthamaa.dhcp.mathworks.com>...
> On Wed, 01 Jul 2009 05:41:02 -0400, Jesper Lauridsen  
> <jesperholst_5@hotmail.com> wrote:
> 
> > I have a text file with the following data:
> >
> > 72008,16193    	-0,01    	0,02    	0,015
> > 72008,16375    	-0,029    	-0,034    	-0,034
> > 72008,16406    	-0,02    	-0,054    	-0,059
> > 72008,16437    	-0,024    	-0,039    	-0,039
> > 72008,16467    	0,02    	-0,044    	-0,044
> > 72008,16498    	-0,005    	-0,005    	-0,005
> > 72008,16529    	0,034    	0,015    	0,01
> > 72008,1656    	0,01    	0,034    	0,034
> > 72008,16591    	0,029    	0,01    	0,01
> >
> > I want to load the data in Matlab and replace the comma with dots. Can I  
> > use the textread function and load it into an cell array and replace the  
> > commas with dots or how do I do it?
> 
> That would be one approach. Did you try it?
> (FOPEN, TEXTSCAN, STRREP, STR2DOUBLE)
> 
Hey everybody. Thank you very much for all your comments. The text file I have contain 4 columns and 800000 rows each. I have to replace the commas with dots in all rows and columns. Therefor I would prefer if it is possible til replace the commas, without writing a new file as Rune surgest. 

I tried:

>> data = importdata('data_in.dat');
>> dlmwrite('data_out.dat',data,'.')
??? Error using ==> dlmwrite
The input cell array can not be converted to a matrix.

The name of the data file i loaded was data_in.dat


To Samuel:

I have tried to open til file in a text editor and tried to use the search and replace function but the file is too big.