Path: news.mathworks.com!newsfeed-00.mathworks.com!oleane.net!oleane!news.in2p3.fr!in2p3.fr!proxad.net!feeder1-2.proxad.net!feeder.erje.net!newsfeed.straub-nv.de!feeder.eternal-september.org!eternal-september.org!not-for-mail
From: dpb <none@non.net>
Newsgroups: comp.soft-sys.matlab
Subject: Re: read large text files
Date: Tue, 27 Oct 2009 20:54:03 -0500
Organization: A noiseless patient Spider
Lines: 27
Message-ID: <hc88hj$k9a$1@news.eternal-september.org>
References: <hc85sr$f4q$1@fred.mathworks.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: news.eternal-september.org U2FsdGVkX19W3HalvbY1No3F8CWkDc8Q9xAbUttY27lpOfYmTlQjKjRnGudDOeRn1N7yrFwfdNRPRvAFmUk36EXkqpwn2y9RnPZ5xCKxwUuzxg8PSjlCAQL0ldRpJtmF8ahkJ+KSO1gl/OsSN0RVFQ==
X-Complaints-To: abuse@eternal-september.org
NNTP-Posting-Date: Wed, 28 Oct 2009 01:59:16 +0000 (UTC)
In-Reply-To: <hc85sr$f4q$1@fred.mathworks.com>
X-Auth-Sender: U2FsdGVkX1/tZYXjTUMBlHueNRSW/t/nDHPoxq2L0/g=
Cancel-Lock: sha1:nITEi9MxkIvsbG0oA+4jYZaPE/0=
User-Agent: Thunderbird 2.0.0.23 (Windows/20090812)
Xref: news.mathworks.com comp.soft-sys.matlab:580493


Anandhi wrote:
...
> When I use this prog I am able to get upto 100000 rows. How to get
> the rows beyond this till the end of file?
> 
> block_size = 100000;
> format = '%f %f %f %f %f %f';
> file_id = fopen(fno{i});
> cnt=0;
> segarray = textscan(file_id, format, block_size); 
...

Don't specify N and textscan() should read to EOF

Alternatively, see

doc textscan

and note one can call textscan repeatedly on the same fid and continue 
from where left off.

Doc doesn't indicate it, but N=-1 in textread() is a flag for "read to 
end of file"; one would presume that would have been implemented in 
textscan() as well.  Also, I'd presume inf would have the same effect. 
I can't test these hypotheses as my version predates textscan().

--