Path: news.mathworks.com!newsfeed-00.mathworks.com!kanaga.switch.ch!switch.ch!news.belwue.de!newsfeed01.sul.t-online.de!t-online.de!newsfeed.straub-nv.de!feeder.eternal-september.org!eternal-september.org!not-for-mail
From: dpb <none@non.net>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Issues Writing to File
Date: Sat, 07 Nov 2009 09:09:53 -0600
Organization: A noiseless patient Spider
Lines: 26
Message-ID: <hd42k8$blr$1@news.eternal-september.org>
References: <hd3sl1$esl$1@fred.mathworks.com> <hd3uer$cnn$1@news.eternal-september.org> <hd3v01$84l$1@fred.mathworks.com> <hd3vur$nnq$1@news.eternal-september.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: news.eternal-september.org U2FsdGVkX1/W+u3RgOXUF5uJMJkRNGP0arzxVzN6mqQhJ2NrnC5zkHp+mVm7Waf8Lqifa3A6rLm3CqW6WqCoqpba+HX7xPoO3+xDovZ5UWmRRt9BU82X9uEpRvBjG5v9TXKHIk8LyBM=
X-Complaints-To: abuse@eternal-september.org
NNTP-Posting-Date: Sat, 7 Nov 2009 15:10:01 +0000 (UTC)
In-Reply-To: <hd3vur$nnq$1@news.eternal-september.org>
X-Auth-Sender: U2FsdGVkX19TMDGyPzN8G3wnE5fXy7NKLEw3Sjr9LuE=
Cancel-Lock: sha1:znb47bM9Trs18f/jfIi+s8MvDkw=
User-Agent: Thunderbird 2.0.0.23 (Windows/20090812)
Xref: news.mathworks.com comp.soft-sys.matlab:583228


dpb wrote:
> Ashley wrote:
> ...
>> Yes thank you I did get the max stress read correctly although I used
>> a different method. Although what you suggested worked I was
>> worried that it would fail if the max stress was for some reason
>> written on a different line. ...
> 
> No, that was the whole point of the 'Maximum' in the format string in 
> textread()--that _requires_ that the string be matched followed by the 
> value so that your certain that it isn't a differing one that will be read.
> 
> Otherwise, if there were a malformed file using '%s %f' would possibly 
> allow you to transparently get a value that wasn't the maximum w/o 
> knowing about it.
> 
> But, it's your data, suit yourself...

OH...dawned on me what your concern was -- it, indeed, somebody were to 
change the format of number of lines/file ahead of the value not a fubar 
in the file itself--yes, the textread() solution does require the format 
be consistent whereas as long as they don't introduce a maximum 
something else before of your intended one the posted solution will 
handle it.

--