Path: news.mathworks.com!not-for-mail
From: "Zahra" <zahra.yamani@nrc.gc.ca>
Newsgroups: comp.soft-sys.matlab
Subject: txt2mat
Date: Mon, 10 Nov 2008 16:46:03 +0000 (UTC)
Organization: National Research Council of Canada
Lines: 30
Message-ID: <gf9ogb$mrb$1@fred.mathworks.com>
Reply-To: "Zahra" <zahra.yamani@nrc.gc.ca>
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 1226335563 23403 172.30.248.35 (10 Nov 2008 16:46:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 10 Nov 2008 16:46:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1060562
Xref: news.mathworks.com comp.soft-sys.matlab:500009


Hi all;

I have an ascii file that has a combination of text and data. The text is a header that repeats throughout the file. The data is of the follwoing format where the line is folded for the same data point:

Point     v1          v2           v3            v4  
Point     v5          v6 
  1        -73         -112        15000        61  
  1         79          79                             
  2        -74        -112         25000        61  
  2         72          74  
and so on...

When I use txt2mat, what I get is the follwoing:  

[1 v1 v2 v3 v4]
[1 v5 v6 NaN NaN]
[2 v1 v2 v3 v4]
[2 v5 v6 NaN NaN]

What I want instead is a matrix where all the values for the same data point are saved in one row as follows: i.e. avoid the line folding in the final matrix:

[1 v1 v2 v3 v4 v5 v6]
[2 v1 v2 v3 v4 v5 v6]


Any advice as how this can be done is appreciated.

Thanks,
Zahra