Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Text file with numbers and text, want to just read numbers
Date: Thu, 3 Jul 2008 20:18:01 +0000 (UTC)
Organization: Boeing Corp
Lines: 43
Message-ID: <g4jc5p$341$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 1215116281 3201 172.30.248.35 (3 Jul 2008 20:18:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 3 Jul 2008 20:18:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 540311
Xref: news.mathworks.com comp.soft-sys.matlab:477447



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

Currently I have Matlab code something like this:

[filename, pathname, filterindex] = uigetfile
({'*.txt','Text file (*.txt)';'*.*','All Files 
(*.*)'},'Pick Time History File');
fid = fopen(filename);
C_text = textscan(fid,'%s');
fclose(fid);


I tried to sort out the header from C_text by creating a 
loop searching for numbers.  Example, seeing if the 
absolute value is greater than one.  This method failed 
when it ran into dates and times.  

Is there a better way?  I've been trying to use textscan, 
but I have also been looking at fscan and textread.  I 
think there may be some formatting with C_text that could 
work, but I couldn't get it to work.