Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Text file with numbers and text, want to just read numbers
Date: Fri, 4 Jul 2008 07:24:02 +0000 (UTC)
Organization: Pierburg GmbH
Lines: 38
Message-ID: <g4kj6i$lei$1@fred.mathworks.com>
References: <g4jc5p$341$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 1215156242 21970 172.30.248.38 (4 Jul 2008 07:24:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 4 Jul 2008 07:24:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 872224
Xref: news.mathworks.com comp.soft-sys.matlab:477486



"Matt " <matthew.r.duncan@boeing.com> wrote in message 
<g4jc5p$341$1@fred.mathworks.com>...
> I have a series of text files I want to read.  The files 
> begin with header information.  The number of rows of 
> header information changes, there is no commenting symbol 
> such as %%, and the header information sometimes has 
> numbers such as a date or a time.  I want to read in the 
> number and only the numbers.  
> 
> This is an example of a file: (Again, the header info 
> changes, different # of lines, different text)
> 
> Vector Signal [Measurement4]:  09/27/2006, 09:05:24
> Units: EU
> Time	 Real
>             0	      0.053732
>      9.6e-005	       0.11968
>      0.000192	      0.085483
>      0.000288	       0.11968
>      0.000384	       0.18562
> 
> [..]

Hi,
you may try txt2mat from the file exchange which heavily 
uses regular expressions to separate the header from the 
numeric data (if the user does not supply the number of 
header lines). It returns this data as a numeric matrix 
variable "A" and the header lines as a string "hl" if you 
type

[A,ffn,nh,SR,hl] = txt2mat('c:\myFile.txt');

You can then parse "hl" separately to extract additional 
numbers.

Regards
Andres