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 16:37:02 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 14
Message-ID: <h068re$9b5$1@fred.mathworks.com>
References: <h05vlj$csf$1@fred.mathworks.com> <h06751$f6f$1@fred.mathworks.com>
Reply-To: "Dominic " <dcg48@cornell.edu>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1244047022 9573 172.30.248.37 (3 Jun 2009 16:37:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 3 Jun 2009 16:37:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1482806
Xref: news.mathworks.com comp.soft-sys.matlab:544574


"Jan Simon" <matlab.THIS_YEAR@nMINUSsimon.de> wrote in message <h06751$f6f$1@fred.mathworks.com>...
> Dear Dominic!
> 
> > 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?
> 
> It depends on what the format of DAT is in your case.
> If you create the DAT files by your own, it would be a trivial idea to write the numbers of rows as initial UINT32.
> If the DAT file contains numbers in ASCII format, you can read a single line with S=FGETL and look for the number of elements after SSCANF(S, '%f').
> Nevertheless, more details about the DAT files must be known to solve the problem.
> 
> Good luck, Jan Simon

The files are all in ASCII format I believe. I created them using dlmwrite so that is what format the should be in. I am a bit confused as to how I can get the number of elements from sscanf without loading the file into the workspace.
Thank you