Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Textread
Date: Wed, 1 Jul 2009 19:21:01 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 32
Message-ID: <h2gcut$ktu$1@fred.mathworks.com>
References: <h2favd$6b6$1@fred.mathworks.com> <op.uwd76lf8a5ziv5@uthamaa.dhcp.mathworks.com> <b6ceba46-a033-4fb4-a70f-967c776bf8d7@h8g2000yqm.googlegroups.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 1246476061 21438 172.30.248.37 (1 Jul 2009 19:21:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 1 Jul 2009 19:21:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1893295
Xref: news.mathworks.com comp.soft-sys.matlab:552145


Rune Allnor <allnor@tele.ntnu.no> wrote in message <b6ceba46-a033-4fb4-a70f-967c776bf8d7@h8g2000yqm.googlegroups.com>...
> On 1 Jul, 20:53, "Jesper Lauridsen" <jesperhols...@hotmail.com> wrote:
> 
> > 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.
> 
> Why is writing a new file a problem? The file can't be *that*
> big. 800000 lines of 50 characters each isn't more than 40 MBytes.
> I am sure you have disk space for that.
> 
> Rune

You are right Rune. I tried the code you surgest:

f1id = fopen('data_in.dat');
f2id = fopen('repairedfile.dat','w');

while (~feof(f1id))
   s = getl(f1id);
   sidx = find(s==',');
   s(sidx) = '.';
   fprintf(f2id,'%s\n',s);
end

fclose(f1id);
fclose(f2id)'

I got the error:

 Undefined command/function 'getl'.

Error in ==> vibrationer at 5
   s = getl(f1id);