Path: news.mathworks.com!not-for-mail
From: "Zahra" <zahra.yamani@nrc.gc.ca>
Newsgroups: comp.soft-sys.matlab
Subject: how to read and write a portion of a file
Date: Tue, 11 Nov 2008 18:35:02 +0000 (UTC)
Organization: National Research Council of Canada
Lines: 54
Message-ID: <gfcj8m$ksi$1@fred.mathworks.com>
Reply-To: "Zahra" <zahra.yamani@nrc.gc.ca>
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 1226428502 21394 172.30.248.38 (11 Nov 2008 18:35:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 11 Nov 2008 18:35:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1060562
Xref: news.mathworks.com comp.soft-sys.matlab:500270


Hi all,

I have a large ascii file. The file contains data from different runs. At the begining of each run there are the same number of header lines. But the number of data point may vary for each run. What I need to do is to write the data for a range of specific runs in the exact same format of the original ascii file. Here I am giving an example of the original file that contains 3 runs:
-----------------------------------------
Run 1
header line 1
header line 2

Point zeta eta gamma delta
Point sig1 sig2
1 1 2 3 4
1 5 6
2 1 2 3 7
2 5 7

Run 2
header line 1
header line 2

Point zeta eta gamma delta
Point sig1 sig2
1 1 2 3 8
1 5 8
2 1 2 3 9
2 5 9

Run 3
header line 1
header line 2

Point zeta eta gamma delta
Point sig1 sig2
1 1 2 3 8
1 5 8
2 1 2 3 9
2 5 9
----------------------------------------------------
For example how do I write only the information for the run 2 (as shown below)  in a separate ascii file but with the exact same formating:

Run 2
header line 1
header line 2

Point zeta eta gamma delta
Point sig1 sig2
1 1 2 3 8
1 5 8
2 1 2 3 9
2 5 9

Can any one help please?

Thanks,
Zahra