Path: news.mathworks.com!newsfeed-00.mathworks.com!solaris.cc.vt.edu!news.vt.edu!news.glorb.com!postnews.google.com!g19g2000yql.googlegroups.com!not-for-mail
From: Rune Allnor <allnor@tele.ntnu.no>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Textread
Date: Wed, 1 Jul 2009 04:00:31 -0700 (PDT)
Organization: http://groups.google.com
Lines: 68
Message-ID: <b141dbcd-f862-4480-8dbc-d1651f2f43f4@g19g2000yql.googlegroups.com>
References: <h2favd$6b6$1@fred.mathworks.com> <h2feei$qfk$1@fred.mathworks.com>
NNTP-Posting-Host: 77.16.72.173
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1246446035 27689 127.0.0.1 (1 Jul 2009 11:00:35 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Wed, 1 Jul 2009 11:00:35 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: g19g2000yql.googlegroups.com; posting-host=77.16.72.173; 
	posting-account=VAp5gAkAAAAmkCze5hvZtMeedpZWNthI
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET 
	CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022),gzip(gfe),gzip(gfe)
Xref: news.mathworks.com comp.soft-sys.matlab:551947


On 1 Jul, 12:40, "Samuel Dorrell" <sdorr...@asl-vision.co.uk> wrote:
> "Jesper Lauridsen" <jesperhols...@hotmail.com> wrote in message <h2favd$6b...@fred.mathworks.com>...
> > 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?
>
> > I would be very happen if somebody could help me:)
>
> Does it have to be done in Matlab? Couldn't you open it in a text editor and use the 'find and replace tool'?

One argument for using matlab would be that the job has
to be repeated for several files.

These kinds of things often occur because of the locale
settings on some computer. On one occasion we found this
very flaw after having delivered hundreds of files to
a paying client. This was a 24/7 operation, and the flaw
was discovered just after I had finished my shift. Next
morning, one guy at the nigh shift had spent 12 hrs
doing the substitution manually:

- Open the file in an editor
- Do the find-replace thing
- Save the file

The only problem was that he had done it in an internal
database, while it was up to me to hand the corrected
files to the clients. For bueraucratic reasons, I had
to either wrap all the newly correcte files (300 if I
remember correctly) nicley in red tape, or repeat the
corrections in my archive of files that were already
'buearaucratically correct' but which still contained
the flaw.

So I wrote a matlab script to do the job. It was slow
compared to the C++ stuff I would have preferred to use,
but matlab was all I had. I got the job - start writing
the script to finished conversion - done in less than
2 hrs.

Very convenient, when you have a bunch of P-O'd clients
and bosses hanging around, fuming with rage and
frustrations.

Rune