Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: file length
Date: Thu, 4 Jun 2009 10:51:01 +0000 (UTC)
Organization: Erasmus MC
Lines: 13
Message-ID: <h088ul$e0s$1@fred.mathworks.com>
References: <h05vlj$csf$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1244112661 14364 172.30.248.38 (4 Jun 2009 10:51:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 4 Jun 2009 10:51:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 870065
Xref: news.mathworks.com comp.soft-sys.matlab:544759


"Dominic " <dcg48@cornell.edu> wrote in message <h05vlj$csf$1@fred.mathworks.com>...
> Hi, 
> I was wondering if anyone knew of a way to find the length (preferably the number of rows) in a .dat file without having to load it into MATLAB?
> Thank you

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. 

hth
Jos