<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p>That was enough, it's working now. Thank you very much for such a straightforward explanation.<br>
</p>
<p><br>
</p>
<p>Grateful,<br>
</p>
<p>Ryne<br>
</p>
<div style="color: rgb(0, 0, 0);">
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> gradsusr-bounces@gradsusr.org &lt;gradsusr-bounces@gradsusr.org&gt; on behalf of Jeff Duda &lt;jeffduda319@gmail.com&gt;<br>
<b>Sent:</b> Tuesday, June 16, 2015 5:14 PM<br>
<b>To:</b> GrADS Users Forum<br>
<b>Subject:</b> Re: [gradsusr] A Faulty IF Loop</font>
<div>&nbsp;</div>
</div>
<div>
<div dir="ltr">
<div>
<div>
<div>
<div>
<div>
<div>
<div>You need to be very explicit with your translation of human statements into code. You might say, &quot;if the lag is 1, 5, 9, or 13 I want to do one thing, and do something different if otherwise.&quot; But to convert that to code you need to explicitly spell out
 EACH logical expression:<br>
</div>
if lag is 1<br>
</div>
if lag is 5<br>
</div>
if lag is 9<br>
</div>
if lag is 13<br>
<br>
</div>
Thus, your if statement should read:<br>
</div>
<b>if (lag = 1 | lag = 5 | lag = 9 | lag = 13)</b><br>
<br>
</div>
Jeff<br>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Tue, Jun 16, 2015 at 4:06 PM, Noska, Ryne <span dir="ltr">
&lt;<a href="mailto:rgn14c@my.fsu.edu" target="_blank">rgn14c@my.fsu.edu</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
<div dir="ltr">
<div style="font-size:12pt; color:#000000; background-color:#ffffff; font-family:Calibri,Arial,Helvetica,sans-serif">
<div style="font-family:wf_segoe-ui_normal,'Segoe UI','Segoe WP',Tahoma,Arial,sans-serif; background-color:rgb(255,255,255)">
<div>
<div>
<div style="min-width:350px; clear:both">
<div style="min-height:70px; border-bottom-width:1px; border-bottom-style:solid; padding-bottom:30px">
<div>
<div>
<div style="clear:both; width:auto; padding-top:12px; word-wrap:break-word">
<div style="font-size:15px; outline:none">
<div dir="ltr"><span dir="ltr">
<div><font color="black" face="Calibri,Arial,Helvetica,sans-serif" size="3"><span style="font-size:12pt">
<div style="margin-top:0px; margin-bottom:0px">I have written a very simple code for the purpose of creating one image with sixteen figures (four rows and four columns). Unfortunately, the loop I have designed to change the location of the next figure is broken.
 Instead of only executing the &quot;if&quot; statement if lag = 1 or 5 or 9 or 13, this portion of the loop is ALWAYS executed. The &quot;else&quot; statement is NEVER executed,&nbsp;<font face="Calibri,Arial,Helvetica,sans-serif" size="2"><span style="font-size:16px">causing the
 figures to run off the page after figure 4 since only ymin and ymax change. Below is a portion of my code; again, the problematic portion is the IF loop:</span></font><br>
</div>
<div style="margin-top:0px; margin-bottom:0px"><font face="Calibri,Arial,Helvetica,sans-serif" size="2"><span style="font-size:16px"><br>
</span></font></div>
<div style="margin-top:0px; margin-bottom:0px"><font face="Calibri,Arial,Helvetica,sans-serif" size="2"><span style="font-size:16px">---------------------------------------</span></font></div>
<div style="margin-top:0px; margin-bottom:0px"><font face="Calibri,Arial,Helvetica,sans-serif" size="2"><span style="font-size:16px"><br>
</span></font></div>
<div>
<div>xmin = 0.25</div>
<div>xmax = 2.50</div>
<div>ymin = 6.25 &#43; 2.00</div>
<div>ymax = 8.00 &#43; 2.00</div>
<div><br>
</div>
<div>lag = 1</div>
<div>while (lag &lt;= 16)</div>
<div>&nbsp; numlag = lag - 1</div>
<div><br>
</div>
<div>&nbsp;<strong>&nbsp;if (lag = 1 | 5 | 9 | 13)</strong></div>
<div><strong>&nbsp; &nbsp; xmin = 0.25</strong></div>
<div><strong>&nbsp; &nbsp; xmax = 2.50</strong></div>
<div><strong>&nbsp; &nbsp; ymin = ymin - 2.00</strong></div>
<div><strong>&nbsp; &nbsp; ymax = ymax - 2.00</strong></div>
<div><strong>&nbsp; else&nbsp;</strong></div>
<div><strong>&nbsp; &nbsp; xmin = xmin &#43; 2.50</strong></div>
<div><strong>&nbsp; &nbsp; xmax = xmax &#43; 2.50</strong></div>
<div><strong>&nbsp; endif</strong></div>
<div><br>
</div>
<div>&nbsp; xlab = ((xmax - xmin)/2) &#43; 0.25</div>
<div>&nbsp; ylab = ymax &#43; 0.125<br>
</div>
<div><br>
</div>
<div>&nbsp; 'set parea 'xmin' 'xmax' 'ymin' 'ymax</div>
<div>&nbsp; 'set xlopts 1 1 0.10'</div>
<div>&nbsp; 'set ylopts 1 1 0.10'</div>
<div>&nbsp; 'set xlint 10'</div>
<div>&nbsp; 'set ylint 10'</div>
<div>&nbsp; 'set xlab off'</div>
<div>&nbsp; 'set ylab off'</div>
<div>&nbsp; 'set grid on'</div>
<div>&nbsp; 'set grads off'</div>
<div>&nbsp; 'set map 1 1 5'</div>
<div>&nbsp; 'set clevs -0.8 -0.7 -0.6 -0.5 -0.4 -0.3 -0.2 -0.1 0.1 0.2 0.3'</div>
<div>&nbsp; 'set ccols 9 &nbsp; 14 &nbsp; 4 &nbsp; &nbsp;11 &nbsp; 5 &nbsp; 13 &nbsp; &nbsp;3 &nbsp; &nbsp;10 &nbsp; 0 &nbsp; 7 &nbsp;12 &nbsp;8'</div>
<div>&nbsp; 'set t 'lag</div>
<div>&nbsp; 'd corr_grdons'</div>
<div>&nbsp; 'set strsiz 0.15'</div>
<div>&nbsp; 'set string 1 c 8'</div>
<div>&nbsp; 'draw string 'xlab' 'ylab' lag='numlag'days'</div>
<div><br>
</div>
<div>&nbsp; lag = lag &#43; 1</div>
<div>endwhile<br>
</div>
<br>
</div>
<div>-------------------------------<br>
</div>
<div><br>
</div>
<div>Any suggestions?<br>
</div>
<div><br>
</div>
<div>Thank you,<br>
</div>
<div>Ryne<br>
</div>
<div><br>
</div>
</span></font></div>
</span></div>
</div>
</div>
</div>
<div style="clear:both">&#8203;<br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<p><br>
</p>
</div>
</div>
<br>
_______________________________________________<br>
gradsusr mailing list<br>
<a href="mailto:gradsusr@gradsusr.org">gradsusr@gradsusr.org</a><br>
<a href="http://gradsusr.org/mailman/listinfo/gradsusr" rel="noreferrer" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
<br>
</blockquote>
</div>
<br>
<br clear="all">
<br>
-- <br>
<div class="gmail_signature">Jeff Duda<br>
Graduate research assistant<br>
University of Oklahoma School of Meteorology<br>
Center for Analysis and Prediction of Storms<br>
</div>
</div>
</div>
</div>
</div>
</body>
</html>