Path: news.mathworks.com!not-for-mail
From: "Dominic " <dcg48@cornell.edu>
Newsgroups: comp.soft-sys.matlab
Subject: Re: file length
Date: Wed, 3 Jun 2009 17:52:01 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 38
Message-ID: <h06d81$850$1@fred.mathworks.com>
References: <h05vlj$csf$1@fred.mathworks.com> <h06437$kts$1@online.de> <h0663p$4te$1@fred.mathworks.com> <h06ctf$er4$1@fred.mathworks.com>
Reply-To: "Dominic " <dcg48@cornell.edu>
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 1244051521 8352 172.30.248.38 (3 Jun 2009 17:52:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 3 Jun 2009 17:52:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1482806
Xref: news.mathworks.com comp.soft-sys.matlab:544593


"Steven Lord" <slord@mathworks.com> wrote in message <h06ctf$er4$1@fred.mathworks.com>...
> 
> "Dominic " <dcg48@cornell.edu> wrote in message 
> news:h0663p$4te$1@fred.mathworks.com...
> > Lothar Schmidt <vapooroop@gmx.net> wrote in message 
> > <h06437$kts$1@online.de>...
> >> Dominic schrieb:
> >> > 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
> >>
> >> number of bytes you can find as follows:
> >>
> >> fileinfo=dir('filename.dat');
> >> fileinfo.size
> >>
> >> difficult to guess the number of row separators without reading the
> >> file... perhaps meanwhile someone has written crystalball.m and put it
> >> in the FEX.
> >>
> >> Lothar
> >
> > Is there any way for me to use the number of bytes in the file to deduce 
> > the number of data points or something along those lines?
> 
> What OS are you using?  If you're on Linux or Solaris (and probably Mac as 
> well, though I haven't tried it) call out to the system (SYSTEM, DOS, UNIX, 
> or !) and use the wc system function.  This will give you, among other 
> information, the newline count for the file.  See "man wc" for more 
> information.
> 
> -- 
> Steve Lord
> slord@mathworks.com 
> 
No I'm using Windows