Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Need advice on File I/O
Date: Wed, 5 Sep 2007 15:42:38 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 34
Message-ID: <fbmipe$16g$1@fred.mathworks.com>
References: <fbaa6i$3pu$1@fred.mathworks.com> <1188629379.871780.250890@w3g2000hsg.googlegroups.com> <fbchfp$g1g$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-06-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1189006958 1232 172.30.248.36 (5 Sep 2007 15:42:38 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 5 Sep 2007 15:42:38 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1030060
Xref: news.mathworks.com comp.soft-sys.matlab:427090



"G.A.M. " <x0zero@gmail.com> wrote in message
<fbchfp$g1g$1@fred.mathworks.com>...
> > > I could use some advice.

Rune Allnor <allnor@tele.ntnu.no> wrote in message
> > Use Walter's method #1, read the data from the
> source
> > file and write the altered data set to the destination file.
> > 
> > Rune
> > 
> "G.A.M. " <x0zero@gmail.com> wrote
> Thanks for your reply. 
> 
> (BTW, searching in here for "Walter's method #1" doesn't
> return any results. I don't know what that method is.
> However, maybe it isn't relevant because the suggestion
> still looks like it requires reading and writing the entire
> file.)

I never did find Walter's reply on the Matlab Newsreader web
page, but I did find his helpful email in my inbox just
today. Here is Walter's method #1:

1) open the input file and open an output file, copy from
input to
output until you find what you need to change, write the changed
data to the output file, then write the rest of the input to the
output. This will work provided there is enough disk space for
the second copy of the file, and is much safer than the other
options because if something goes wrong in the middle of the
process, you would still have the input file unchanged.