Path: news.mathworks.com!not-for-mail
From: "Zahra" <zahra.yamani@nrc.gc.ca>
Newsgroups: comp.soft-sys.matlab
Subject: ascii import
Date: Mon, 10 Nov 2008 19:32:02 +0000 (UTC)
Organization: National Research Council of Canada
Lines: 41
Message-ID: <gfa27i$kr6$1@fred.mathworks.com>
Reply-To: "Zahra" <zahra.yamani@nrc.gc.ca>
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 1226345522 21350 172.30.248.37 (10 Nov 2008 19:32:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 10 Nov 2008 19:32:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1060562
Xref: news.mathworks.com comp.soft-sys.matlab:500055


Hi all,

Can any one help for the following:

I need to import data from an ascii file. The file includes different data runs that are separated by a header (the text of the header changes from one run to the next but the number of header lines remain the same for different runs). Then each run has the same number of data points. The only problem is that for each data point, the data is given in two lines (there is a line folding) starting with the point number in the run. Here is an example of the data file, lets assume there are two runs in it and each run has two points:
--------------------------------
Run   1   
header line 1
header line 2
Point1   v1   v2   v3   v4 
Point1   v5   v6 
Point2   v1'   v2'   v3'   v4' 
Point2   v5'   v6' 

Run  2   
header line 1
header line 2
Point1   vv1   vv2   vv3   vv4 
Point1   vv5   vv6 
Point2   vv1'   vv2'   vv3'   vv4' 
Point2   vv5'   vv6'
-------------------------------------------
and so on...

What I need is to remove all the header lines and have a matrix that each of its rows represents a data point and its column are the data values, i.e. the rows of the final matrix need to be in the following format:

row 1=[Point1   v1   v2   v3   v4   v5   v6]
row 2=[Point2   v1'   v2'   v3'   v4'   v5'   v6']
row 3=[Point1   vv1   vv2   vv3   vv4   vv5   vv6]
row 4=[Point2   vv1'   vv2'   vv3'   vv4'   vv5'   vv6']

I have tried different options in txt2mat, but with each option there is one problem or another.

Can any one help?

Thanks,
Zahra