Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!r36g2000prf.googlegroups.com!not-for-mail
From: Rune Allnor <allnor@tele.ntnu.no>
Newsgroups: comp.soft-sys.matlab
Subject: Re: read ascii file
Date: Mon, 10 Nov 2008 04:12:50 -0800 (PST)
Organization: http://groups.google.com
Lines: 22
Message-ID: <e2d1e726-82c5-4d32-865d-ab0700e0f092@r36g2000prf.googlegroups.com>
References: <gf909u$4n9$1@fred.mathworks.com>
NNTP-Posting-Host: 77.17.159.216
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1226319171 9617 127.0.0.1 (10 Nov 2008 12:12:51 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Mon, 10 Nov 2008 12:12:51 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: r36g2000prf.googlegroups.com; posting-host=77.17.159.216; 
	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:499913


On 10 Nov, 10:53, "DS" <n...@null.com> wrote:
> Hello all. =A0I need to read in an ascii file, with mixed char and numeri=
c data, and I'm reading fairly big files so I would like it to be fast.

"Text data" and "fast access" are contradictions in terms.
Expect 2-5s delay per 10 MByte of text data in the file.


>=A0The files look something like this:
>
> {{0,0,0, ... lots of numbers ... ,0,0,0},{0,0,0, ... lots of numbers ... =
,0,0,0}, etc }
>
> It's a square matrix all on a single line, comma delimited, with each row=
 and the entire matrix enclosed in curly braces.
>
> I can manage a for-loop "hack all the braces out" approach, but is there =
a better way for something with this simple format?

Regular expressions is the obvious first try.

Rune