Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: how to read and write a portion of a file
Date: Tue, 11 Nov 2008 21:50:18 +0000 (UTC)
Organization: University of Toronto
Lines: 63
Message-ID: <gfcumq$rg1$1@fred.mathworks.com>
References: <gfcj8m$ksi$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 1226440218 28161 172.30.248.35 (11 Nov 2008 21:50:18 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 11 Nov 2008 21:50:18 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1264521
Xref: news.mathworks.com comp.soft-sys.matlab:500303


Hi,

I am not sure if this is an answer to what you're asking for but as a suggestion, try the textscan function in MATLAB.  Read the Help documentation on this function. The 'HeaderLines' parameter under User Configurable Options (in the help page of textscan function) may be helpful to you. 

Regards,
Negar


"Zahra" <zahra.yamani@nrc.gc.ca> wrote in message <gfcj8m$ksi$1@fred.mathworks.com>...
> 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