<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/165297</link>
    <title>MATLAB Central Newsreader - while loop problem</title>
    <description>Feed for thread: while loop problem</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Fri, 07 Mar 2008 23:49:02 -0500</pubDate>
      <title>while loop problem</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/165297#419721</link>
      <author>Steve </author>
      <description>I'm trying to grow a vector using 'while' and there seems &lt;br&gt;
to be a sort of instability somewhere.  Sometimes (but not &lt;br&gt;
always), it does not stop looping when I think it should.  &lt;br&gt;
I have copied part of the code below.&lt;br&gt;
&lt;br&gt;
On several equations, plotting Kmax_net shows that Kmax_net &lt;br&gt;
does become larger than Kc.  There is always an immediate &lt;br&gt;
drop off at this point, and Kmax_net starts growing again.  &lt;br&gt;
This may happen two or three times before it finally goes &lt;br&gt;
above Kc and the loop ends.  Why isn't the loop terminating &lt;br&gt;
the first time through?  Any suggestions?  Thanks!&lt;br&gt;
&lt;br&gt;
----------------------&lt;br&gt;
&lt;br&gt;
while Kmax_net(i)&amp;lt;Kc&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;i=i+1;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;% calculate crack propagation&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Kmax_app(i)=1.12*Smax*sqrt(pi*a(i-1));&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Kmin_app(i)=1.12*Smin*sqrt(pi*a(i-1));&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Kresidual(i)=interp1(KresTable(:,1),KresTable(:,2),a(i-&lt;br&gt;
1));&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Kmax_net(i)=Kmax_app(i)+Kresidual(i);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if Kmax_net(i)&amp;lt;0&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Kmax_net(i)=0;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;else&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Kmax_net(i)=Kmax_net(i);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;end&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Kmin_net(i)=Kmin_app(i)+Kresidual(i);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if Kmin_net(i)&amp;lt;0&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Kmin_net(i)=0;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;else&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Kmin_net(i)=Kmin_net(i);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;end&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;dKnet(i)=Kmax_net(i)-Kmin_net(i);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Rnet(i)=Kmin_net(i)/Kmax_net(i);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;da(i)=C*(dKnet(i))^M/((1-Rnet(i))*Kc-dKnet(i));&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;a(i)=a(i-1)+da(i);&lt;br&gt;
end&lt;br&gt;
&lt;br&gt;
------------------------------</description>
    </item>
    <item>
      <pubDate>Sat, 08 Mar 2008 00:14:03 -0500</pubDate>
      <title>Re: while loop problem</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/165297#419722</link>
      <author>us</author>
      <description>&quot;Steve &quot;:&lt;br&gt;
&amp;lt;SNIP obviously a CSSM newbie...&lt;br&gt;
&lt;br&gt;
&amp;gt; while Kmax_net(i)&amp;lt;Kc&lt;br&gt;
&amp;gt;     i=i+1;&lt;br&gt;
&amp;gt;     % calculate crack propagation&lt;br&gt;
&amp;gt;     Kmax_app(i)=1.12*Smax*sqrt(pi*a(i-1));&lt;br&gt;
&amp;gt;     Kmin_app(i)=1.12*Smin*sqrt(pi*a(i-1));&lt;br&gt;
&amp;gt;     Kresidual(i)=interp1(KresTable(:,1),KresTable(:,2),a&lt;br&gt;
(i-&lt;br&gt;
&amp;gt; 1));&lt;br&gt;
&amp;gt;     Kmax_net(i)=Kmax_app(i)+Kresidual(i);&lt;br&gt;
&amp;gt;     if Kmax_net(i)&amp;lt;0&lt;br&gt;
&amp;gt;         Kmax_net(i)=0;&lt;br&gt;
&amp;gt;     else&lt;br&gt;
&amp;gt;         Kmax_net(i)=Kmax_net(i);&lt;br&gt;
&amp;gt;     end&lt;br&gt;
&amp;gt;     Kmin_net(i)=Kmin_app(i)+Kresidual(i);&lt;br&gt;
&amp;gt;     if Kmin_net(i)&amp;lt;0&lt;br&gt;
&amp;gt;         Kmin_net(i)=0;&lt;br&gt;
&amp;gt;     else&lt;br&gt;
&amp;gt;         Kmin_net(i)=Kmin_net(i);&lt;br&gt;
&amp;gt;     end&lt;br&gt;
&amp;gt;     dKnet(i)=Kmax_net(i)-Kmin_net(i);&lt;br&gt;
&amp;gt;     Rnet(i)=Kmin_net(i)/Kmax_net(i);&lt;br&gt;
&amp;gt;     da(i)=C*(dKnet(i))^M/((1-Rnet(i))*Kc-dKnet(i));&lt;br&gt;
&amp;gt;     a(i)=a(i-1)+da(i);&lt;br&gt;
&amp;gt; end&lt;br&gt;
&lt;br&gt;
this is NOT the way to ask for help in this lovely NG...&lt;br&gt;
&lt;br&gt;
1) nobody will ever be able to guess the contents of your &lt;br&gt;
(fancily - or shall we call it: tediously - christened) &lt;br&gt;
variables...&lt;br&gt;
2) your snipplet is badly wrapped, which means: CSSMers &lt;br&gt;
cannot easily copy/paste it for further examinations... and &lt;br&gt;
NOBODY has/will ever spend the time to re-type your &lt;br&gt;
particular stuff into an m-scriplet as all of us have to &lt;br&gt;
finish some nobel-prize winning nature submissions and - by &lt;br&gt;
nature - are not REALLY interested in your problem...&lt;br&gt;
&lt;br&gt;
conclusion:&lt;br&gt;
come up with the most frugal(!) code skeleton that &lt;br&gt;
reproduces your problem/error - and (most likely) thou &lt;br&gt;
shallst (sic!) be enlightened...&lt;br&gt;
otherwise, all you get is guess-work - and corrections on &lt;br&gt;
your part - and more guess-work - and people getting &lt;br&gt;
(slightly) annoyed...&lt;br&gt;
&lt;br&gt;
sorry...&lt;br&gt;
us</description>
    </item>
    <item>
      <pubDate>Sat, 08 Mar 2008 00:33:01 -0500</pubDate>
      <title>Re: while loop problem</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/165297#419724</link>
      <author>Roger Stafford</author>
      <description>&quot;Steve &quot; &amp;lt;steveDEL.bachmeierDEL@yahoo.com&amp;gt; wrote in message &amp;lt;fqsk9e&lt;br&gt;
$73s$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; I'm trying to grow a vector using 'while' and there seems &lt;br&gt;
&amp;gt; to be a sort of instability somewhere.  Sometimes (but not &lt;br&gt;
&amp;gt; always), it does not stop looping when I think it should.  &lt;br&gt;
&amp;gt; I have copied part of the code below.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; On several equations, plotting Kmax_net shows that Kmax_net &lt;br&gt;
&amp;gt; does become larger than Kc.  There is always an immediate &lt;br&gt;
&amp;gt; drop off at this point, and Kmax_net starts growing again.  &lt;br&gt;
&amp;gt; This may happen two or three times before it finally goes &lt;br&gt;
&amp;gt; above Kc and the loop ends.  Why isn't the loop terminating &lt;br&gt;
&amp;gt; the first time through?  Any suggestions?  Thanks!&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; ----------------------&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; while Kmax_net(i)&amp;lt;Kc&lt;br&gt;
&amp;gt;     i=i+1;&lt;br&gt;
&amp;gt;     % calculate crack propagation&lt;br&gt;
&amp;gt;     Kmax_app(i)=1.12*Smax*sqrt(pi*a(i-1));&lt;br&gt;
&amp;gt;     Kmin_app(i)=1.12*Smin*sqrt(pi*a(i-1));&lt;br&gt;
&amp;gt;     Kresidual(i)=interp1(KresTable(:,1),KresTable(:,2),a(i-&lt;br&gt;
&amp;gt; 1));&lt;br&gt;
&amp;gt;     Kmax_net(i)=Kmax_app(i)+Kresidual(i);&lt;br&gt;
&amp;gt;     if Kmax_net(i)&amp;lt;0&lt;br&gt;
&amp;gt;         Kmax_net(i)=0;&lt;br&gt;
&amp;gt;     else&lt;br&gt;
&amp;gt;         Kmax_net(i)=Kmax_net(i);&lt;br&gt;
&amp;gt;     end&lt;br&gt;
&amp;gt;     Kmin_net(i)=Kmin_app(i)+Kresidual(i);&lt;br&gt;
&amp;gt;     if Kmin_net(i)&amp;lt;0&lt;br&gt;
&amp;gt;         Kmin_net(i)=0;&lt;br&gt;
&amp;gt;     else&lt;br&gt;
&amp;gt;         Kmin_net(i)=Kmin_net(i);&lt;br&gt;
&amp;gt;     end&lt;br&gt;
&amp;gt;     dKnet(i)=Kmax_net(i)-Kmin_net(i);&lt;br&gt;
&amp;gt;     Rnet(i)=Kmin_net(i)/Kmax_net(i);&lt;br&gt;
&amp;gt;     da(i)=C*(dKnet(i))^M/((1-Rnet(i))*Kc-dKnet(i));&lt;br&gt;
&amp;gt;     a(i)=a(i-1)+da(i);&lt;br&gt;
&amp;gt; end&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; ------------------------------&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;Here is my best guess as to your difficulty, Steve.  The while-loop is actually &lt;br&gt;
stopping each time it detects a Kmex_net above Kc, just as you planned.  &lt;br&gt;
However, I am guessing you haven't cleared out this vector from previous &lt;br&gt;
runs with it, so a plot gives you two or more pieces of Kmex_net's history all &lt;br&gt;
in the same plot.  That would also account for the abrupt jump down you see &lt;br&gt;
at each such transition from one run to a previous one.&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;In any case, whenever it is at all possible you should pre-allocate a vector &lt;br&gt;
rather than letting it grow one element at a time, which greatly extends &lt;br&gt;
execution time.&lt;br&gt;
&lt;br&gt;
Roger Stafford</description>
    </item>
    <item>
      <pubDate>Sat, 08 Mar 2008 00:45:09 -0500</pubDate>
      <title>Re: while loop problem</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/165297#419726</link>
      <author>us</author>
      <description>&quot;Roger Stafford&quot;:&lt;br&gt;
&amp;lt;SNIP verification of a previous post...&lt;br&gt;
&lt;br&gt;
&amp;gt; Here is my best guess...&lt;br&gt;
&lt;br&gt;
as i said: guess-work...&lt;br&gt;
&lt;br&gt;
us</description>
    </item>
    <item>
      <pubDate>Sat, 08 Mar 2008 01:00:19 -0500</pubDate>
      <title>Re: while loop problem</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/165297#419727</link>
      <author>Steve </author>
      <description>hmm, I thought that also, but somewhere along the way&lt;br&gt;
convinced myself that it is not the problem.  But seeing as&lt;br&gt;
how I can't recall how I managed to convince myself of that,&lt;br&gt;
I'll have to go back and ensure.&lt;br&gt;
&lt;br&gt;
As for preallocating, is it best just to preallocate as more&lt;br&gt;
zeros than I think I'll need?&lt;br&gt;
&lt;br&gt;
Thanks!&lt;br&gt;
&lt;br&gt;
&quot;Roger Stafford&quot; &amp;lt;ellieandrogerxyzzy@mindspring.com.invalid&amp;gt;&lt;br&gt;
wrote in message &amp;lt;fqsmrt$s9p$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &quot;Steve &quot; &amp;lt;steveDEL.bachmeierDEL@yahoo.com&amp;gt; wrote in&lt;br&gt;
message &amp;lt;fqsk9e&lt;br&gt;
&amp;gt; $73s$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; I'm trying to grow a vector using 'while' and there seems &lt;br&gt;
&amp;gt; &amp;gt; to be a sort of instability somewhere.  Sometimes (but not &lt;br&gt;
&amp;gt; &amp;gt; always), it does not stop looping when I think it should.  &lt;br&gt;
&amp;gt; &amp;gt; I have copied part of the code below.&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; On several equations, plotting Kmax_net shows that Kmax_net &lt;br&gt;
&amp;gt; &amp;gt; does become larger than Kc.  There is always an immediate &lt;br&gt;
&amp;gt; &amp;gt; drop off at this point, and Kmax_net starts growing again.  &lt;br&gt;
&amp;gt; &amp;gt; This may happen two or three times before it finally goes &lt;br&gt;
&amp;gt; &amp;gt; above Kc and the loop ends.  Why isn't the loop terminating &lt;br&gt;
&amp;gt; &amp;gt; the first time through?  Any suggestions?  Thanks!&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; ----------------------&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; while Kmax_net(i)&amp;lt;Kc&lt;br&gt;
&amp;gt; &amp;gt;     i=i+1;&lt;br&gt;
&amp;gt; &amp;gt;     % calculate crack propagation&lt;br&gt;
&amp;gt; &amp;gt;     Kmax_app(i)=1.12*Smax*sqrt(pi*a(i-1));&lt;br&gt;
&amp;gt; &amp;gt;     Kmin_app(i)=1.12*Smin*sqrt(pi*a(i-1));&lt;br&gt;
&amp;gt; &amp;gt;     Kresidual(i)=interp1(KresTable(:,1),KresTable(:,2),a(i-&lt;br&gt;
&amp;gt; &amp;gt; 1));&lt;br&gt;
&amp;gt; &amp;gt;     Kmax_net(i)=Kmax_app(i)+Kresidual(i);&lt;br&gt;
&amp;gt; &amp;gt;     if Kmax_net(i)&amp;lt;0&lt;br&gt;
&amp;gt; &amp;gt;         Kmax_net(i)=0;&lt;br&gt;
&amp;gt; &amp;gt;     else&lt;br&gt;
&amp;gt; &amp;gt;         Kmax_net(i)=Kmax_net(i);&lt;br&gt;
&amp;gt; &amp;gt;     end&lt;br&gt;
&amp;gt; &amp;gt;     Kmin_net(i)=Kmin_app(i)+Kresidual(i);&lt;br&gt;
&amp;gt; &amp;gt;     if Kmin_net(i)&amp;lt;0&lt;br&gt;
&amp;gt; &amp;gt;         Kmin_net(i)=0;&lt;br&gt;
&amp;gt; &amp;gt;     else&lt;br&gt;
&amp;gt; &amp;gt;         Kmin_net(i)=Kmin_net(i);&lt;br&gt;
&amp;gt; &amp;gt;     end&lt;br&gt;
&amp;gt; &amp;gt;     dKnet(i)=Kmax_net(i)-Kmin_net(i);&lt;br&gt;
&amp;gt; &amp;gt;     Rnet(i)=Kmin_net(i)/Kmax_net(i);&lt;br&gt;
&amp;gt; &amp;gt;     da(i)=C*(dKnet(i))^M/((1-Rnet(i))*Kc-dKnet(i));&lt;br&gt;
&amp;gt; &amp;gt;     a(i)=a(i-1)+da(i);&lt;br&gt;
&amp;gt; &amp;gt; end&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; ------------------------------&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;   Here is my best guess as to your difficulty, Steve.  The&lt;br&gt;
while-loop is actually &lt;br&gt;
&amp;gt; stopping each time it detects a Kmex_net above Kc, just as&lt;br&gt;
you planned.  &lt;br&gt;
&amp;gt; However, I am guessing you haven't cleared out this vector&lt;br&gt;
from previous &lt;br&gt;
&amp;gt; runs with it, so a plot gives you two or more pieces of&lt;br&gt;
Kmex_net's history all &lt;br&gt;
&amp;gt; in the same plot.  That would also account for the abrupt&lt;br&gt;
jump down you see &lt;br&gt;
&amp;gt; at each such transition from one run to a previous one.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;   In any case, whenever it is at all possible you should&lt;br&gt;
pre-allocate a vector &lt;br&gt;
&amp;gt; rather than letting it grow one element at a time, which&lt;br&gt;
greatly extends &lt;br&gt;
&amp;gt; execution time.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Roger Stafford&lt;br&gt;
&amp;gt; </description>
    </item>
    <item>
      <pubDate>Sat, 08 Mar 2008 01:03:02 -0500</pubDate>
      <title>Re: while loop problem</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/165297#419728</link>
      <author>Steve </author>
      <description>I know, I know, I was in a rush finishing MY Nobel&lt;br&gt;
prize-winning Nature submission and wanted to get it up just&lt;br&gt;
in case.  I'll re-post.  Thanks!&lt;br&gt;
&lt;br&gt;
&quot;us &quot; &amp;lt;us@neurol.unizh.ch&amp;gt; wrote in message&lt;br&gt;
&amp;lt;fqslob$jgb$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &quot;Steve &quot;:&lt;br&gt;
&amp;gt; &amp;lt;SNIP obviously a CSSM newbie...&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; while Kmax_net(i)&amp;lt;Kc&lt;br&gt;
&amp;gt; &amp;gt;     i=i+1;&lt;br&gt;
&amp;gt; &amp;gt;     % calculate crack propagation&lt;br&gt;
&amp;gt; &amp;gt;     Kmax_app(i)=1.12*Smax*sqrt(pi*a(i-1));&lt;br&gt;
&amp;gt; &amp;gt;     Kmin_app(i)=1.12*Smin*sqrt(pi*a(i-1));&lt;br&gt;
&amp;gt; &amp;gt;     Kresidual(i)=interp1(KresTable(:,1),KresTable(:,2),a&lt;br&gt;
&amp;gt; (i-&lt;br&gt;
&amp;gt; &amp;gt; 1));&lt;br&gt;
&amp;gt; &amp;gt;     Kmax_net(i)=Kmax_app(i)+Kresidual(i);&lt;br&gt;
&amp;gt; &amp;gt;     if Kmax_net(i)&amp;lt;0&lt;br&gt;
&amp;gt; &amp;gt;         Kmax_net(i)=0;&lt;br&gt;
&amp;gt; &amp;gt;     else&lt;br&gt;
&amp;gt; &amp;gt;         Kmax_net(i)=Kmax_net(i);&lt;br&gt;
&amp;gt; &amp;gt;     end&lt;br&gt;
&amp;gt; &amp;gt;     Kmin_net(i)=Kmin_app(i)+Kresidual(i);&lt;br&gt;
&amp;gt; &amp;gt;     if Kmin_net(i)&amp;lt;0&lt;br&gt;
&amp;gt; &amp;gt;         Kmin_net(i)=0;&lt;br&gt;
&amp;gt; &amp;gt;     else&lt;br&gt;
&amp;gt; &amp;gt;         Kmin_net(i)=Kmin_net(i);&lt;br&gt;
&amp;gt; &amp;gt;     end&lt;br&gt;
&amp;gt; &amp;gt;     dKnet(i)=Kmax_net(i)-Kmin_net(i);&lt;br&gt;
&amp;gt; &amp;gt;     Rnet(i)=Kmin_net(i)/Kmax_net(i);&lt;br&gt;
&amp;gt; &amp;gt;     da(i)=C*(dKnet(i))^M/((1-Rnet(i))*Kc-dKnet(i));&lt;br&gt;
&amp;gt; &amp;gt;     a(i)=a(i-1)+da(i);&lt;br&gt;
&amp;gt; &amp;gt; end&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; this is NOT the way to ask for help in this lovely NG...&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; 1) nobody will ever be able to guess the contents of your &lt;br&gt;
&amp;gt; (fancily - or shall we call it: tediously - christened) &lt;br&gt;
&amp;gt; variables...&lt;br&gt;
&amp;gt; 2) your snipplet is badly wrapped, which means: CSSMers &lt;br&gt;
&amp;gt; cannot easily copy/paste it for further examinations... and &lt;br&gt;
&amp;gt; NOBODY has/will ever spend the time to re-type your &lt;br&gt;
&amp;gt; particular stuff into an m-scriplet as all of us have to &lt;br&gt;
&amp;gt; finish some nobel-prize winning nature submissions and - by &lt;br&gt;
&amp;gt; nature - are not REALLY interested in your problem...&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; conclusion:&lt;br&gt;
&amp;gt; come up with the most frugal(!) code skeleton that &lt;br&gt;
&amp;gt; reproduces your problem/error - and (most likely) thou &lt;br&gt;
&amp;gt; shallst (sic!) be enlightened...&lt;br&gt;
&amp;gt; otherwise, all you get is guess-work - and corrections on &lt;br&gt;
&amp;gt; your part - and more guess-work - and people getting &lt;br&gt;
&amp;gt; (slightly) annoyed...&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; sorry...&lt;br&gt;
&amp;gt; us</description>
    </item>
    <item>
      <pubDate>Sat, 08 Mar 2008 01:21:02 -0500</pubDate>
      <title>Re: while loop problem</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/165297#419731</link>
      <author>Roger Stafford</author>
      <description>&quot;us &quot; &amp;lt;us@neurol.unizh.ch&amp;gt; wrote in message &amp;lt;fqsnik$6kj&lt;br&gt;
$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; as i said: guess-work...&lt;br&gt;
&amp;gt; us&lt;br&gt;
----------&lt;br&gt;
&amp;nbsp;&amp;nbsp;I wouldn't be too hard on him, Urs.  It's the kind of matlab mistake I've made &lt;br&gt;
myself more times than I'd like to admit.  Moreover, it it clear that he had no &lt;br&gt;
idea what he had forgotten to do, so his presentation was perhaps the best that &lt;br&gt;
could be made under the circumstances.  He unknowingly revealed in his &lt;br&gt;
description and code, the very clues that (hopefully) allow the mystery to be &lt;br&gt;
cleared up.&lt;br&gt;
&lt;br&gt;
Roger Stafford</description>
    </item>
    <item>
      <pubDate>Sat, 08 Mar 2008 01:39:03 -0500</pubDate>
      <title>Re: while loop problem</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/165297#419732</link>
      <author>Roger Stafford</author>
      <description>&quot;Steve &quot; &amp;lt;steveDEL.bachmeierDEL@yahoo.com&amp;gt; wrote in message &amp;lt;fqsof3&lt;br&gt;
$gkl$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; hmm, I thought that also, but somewhere along the way&lt;br&gt;
&amp;gt; convinced myself that it is not the problem.  But seeing as&lt;br&gt;
&amp;gt; how I can't recall how I managed to convince myself of that,&lt;br&gt;
&amp;gt; I'll have to go back and ensure.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; As for preallocating, is it best just to preallocate as more&lt;br&gt;
&amp;gt; zeros than I think I'll need?&lt;br&gt;
&lt;br&gt;
&amp;nbsp;Yes, Steve, I would allocate an all zero vector long enough to exceed any &lt;br&gt;
conceivable set of circumstances, then proceed with the while-loop one entry &lt;br&gt;
at a time (provided there isn't some vectorized method of getting around the &lt;br&gt;
loop), and when you emerge from the loop, finally lop off the unused portion &lt;br&gt;
of the vector, making use of the 'i' index.  That way you will not be misled by &lt;br&gt;
a plot of the vector.  If it happens that you did after all underestimate the &lt;br&gt;
needed length, the computation can still proceed successfully though of &lt;br&gt;
course a lot slower.&lt;br&gt;
&lt;br&gt;
Roger Stafford</description>
    </item>
    <item>
      <pubDate>Sat, 08 Mar 2008 01:40:24 -0500</pubDate>
      <title>Re: while loop problem</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/165297#419733</link>
      <author>us</author>
      <description>&quot;Roger Stafford&quot;:&lt;br&gt;
&amp;lt;SNIP he that is without sin among you, let him first cast &lt;br&gt;
a stone at her - or was it a CSSM newbie...&lt;br&gt;
&lt;br&gt;
&amp;gt;   I wouldn't be too hard on him, Urs.  It's the kind of &lt;br&gt;
matlab mistake I've made myself more times than I'd like to &lt;br&gt;
admit...&lt;br&gt;
&lt;br&gt;
but then, dear &amp;lt;roger&amp;gt;, you (most obviously) have improved &lt;br&gt;
grandly(!) over the past forty years!...&lt;br&gt;
&lt;br&gt;
urs with a :-) and greetings from zurich</description>
    </item>
    <item>
      <pubDate>Sat, 08 Mar 2008 02:16:02 -0500</pubDate>
      <title>Re: while loop problem</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/165297#419736</link>
      <author>Roger Stafford</author>
      <description>&quot;us &quot; &amp;lt;us@neurol.unizh.ch&amp;gt; wrote in message &amp;lt;fqsqq8$cps&lt;br&gt;
$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &quot;Roger Stafford&quot;:&lt;br&gt;
&amp;gt; &amp;lt;SNIP he that is without sin among you, let him first cast &lt;br&gt;
&amp;gt; a stone at her - or was it a CSSM newbie...&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt;   I wouldn't be too hard on him, Urs.  It's the kind of &lt;br&gt;
&amp;gt; matlab mistake I've made myself more times than I'd like to &lt;br&gt;
&amp;gt; admit...&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; but then, dear &amp;lt;roger&amp;gt;, you (most obviously) have improved &lt;br&gt;
&amp;gt; grandly(!) over the past forty years!...&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; urs with a :-) and greetings from zurich&lt;br&gt;
----------&lt;br&gt;
&amp;nbsp;&amp;nbsp;I thank you for that Urs.  However, you are overly kind.  As an octogenarian of &lt;br&gt;
82, I'm afraid my days of improvement are long over, and it is becoming more &lt;br&gt;
and more difficult to keep up with all you young guys.&lt;br&gt;
&lt;br&gt;
Roger Stafford (with greetings from Orange, California)</description>
    </item>
    <item>
      <pubDate>Fri, 28 Oct 2011 13:52:14 -0400</pubDate>
      <title>Re: while loop problem</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/165297#856601</link>
      <author>suren </author>
      <description>post the full code..then it can be done..need more details.or if you dont want to post it in public domain fix it yourself</description>
    </item>
  </channel>
</rss>

