Path: news.mathworks.com!not-for-mail
From: "Dominic " <dcg48@cornell.edu>
Newsgroups: comp.soft-sys.matlab
Subject: Re: file length
Date: Thu, 4 Jun 2009 13:50:18 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 13
Message-ID: <h08jeq$jfa$1@fred.mathworks.com>
References: <h05vlj$csf$1@fred.mathworks.com> <h088ul$e0s$1@fred.mathworks.com> <h08gka$aim$1@fred.mathworks.com>
Reply-To: "Dominic " <dcg48@cornell.edu>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1244123418 19946 172.30.248.35 (4 Jun 2009 13:50:18 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 4 Jun 2009 13:50:18 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1482806
Xref: news.mathworks.com comp.soft-sys.matlab:544809


"Kenneth Eaton" <Kenneth.dot.Eaton@cchmc.dot.org> wrote in message <h08gka$aim$1@fred.mathworks.com>...
> "Jos " <#10584@fileexchange.com> wrote in message <h088ul$e0s$1@fred.mathworks.com>...
> > For ascii files, this might do the job
> > 
> > Nrows = numel(textread('mydata.txt','%1c%*[^\n]'))
> > 
> > Note that it does read in some data (temporarily!): one character per non-empty row. 
> 
> One caveat: This solution won't count empty rows that consist of only a newline character. However, if you know there will always be something in every row, this should work great.
> 
> Note: Newer versions of MATLAB urge the use of TEXTSCAN over TEXTREAD. I'm guessing eventually TEXTREAD will be phased out.

The function worked great. Thanks!