Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: file length
Date: Wed, 3 Jun 2009 16:08:01 +0000 (UTC)
Organization: Universit&#228;t Heidelberg
Lines: 10
Message-ID: <h06751$f6f$1@fred.mathworks.com>
References: <h05vlj$csf$1@fred.mathworks.com>
Reply-To: <HIDDEN>
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 1244045281 15567 172.30.248.35 (3 Jun 2009 16:08:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 3 Jun 2009 16:08:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 869888
Xref: news.mathworks.com comp.soft-sys.matlab:544564


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