<div dir="ltr"><div>Hi Zoey,</div><div><br></div><div>In this case, you may just read the values inside the do loop, and delete the variable at the end of the loop.</div><div><br></div><div><font color="#ff0000">izMin = (/.../)</font></div><div><font color="#ff0000">izMax = (/.../)</font></div><div><br></div>do i = 1, 13<div><font color="#0000ff"> iz = ind(field(0,:).ge.izMin(i) .and. field(0,:).lt.izMax(i)) </font><font color="#ff0000">; define izMin and izMax explicitly before executing the loop</font></div><div><br></div><div> if (.not. any(ismissing(iz)) then</div><div> print("Number of data fall between "+ izMin(i) + " and " + izMax(i) + " = " + dimsizes(iz))</div><div> else</div><div> print("No data can be found for the values between "+ izMin(i) + " and " + izMax(i))</div><div> end if</div><div><font color="#0000ff"><br></font></div><div><font color="#0000ff"> delete(iz)</font></div><div>end do</div><div><br></div><div>Cheers, </div><div>Hoffman</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-11-10 3:44 GMT+01:00 <span dir="ltr"><<a href="mailto:xyzheng@mail.ustc.edu.cn" target="_blank">xyzheng@mail.ustc.edu.cn</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><font size="4"><font face="
Times New Roman
">Hello,</font></font><br><font size="4"><font face="
Times New Roman
">I am looking for a way to <font face="
Times New Roman
"><font face="
Times New Roman
">call a<font face="
Times New Roman
"> series of variables</font></font></font> through their names (string) in NCL<font face="
Times New Roman
">.</font></font></font><font size="4"><font face="
Times New Roman
"><font face="
Times New Roman
"><font size="4"><font face="
Times New Roman
"><font face="
Times New Roman
"><font size="4"><font face="
Times New Roman
">These variables are of different sizes,so <font face="
Times New Roman
"><font face="
Times New Roman
">they</font> can't be set as an array iz(k) of<font face="
Times New Roman
"> fixed size. <font face="
Times New Roman
"> <font face="
Times New Roman
">A<font face="
Times New Roman
">nd <font face="
Times New Roman
">I</font></font></font> <font face="
Times New Roman
">don't know how to do loop <font face="
Times New Roman
">and </font></font></font></font></font></font></font></font></font></font></font></font></font><font size="4"><font face="
Times New Roman
"><font face="
Times New Roman
"><font size="4"><font face="
Times New Roman
"><font face="
Times New Roman
"><font size="4"><font face="
Times New Roman
"><font face="
Times New Roman
"><font face="
Times New Roman
"><font face="
Times New Roman
"><font face="
Times New Roman
"><font size="4"><font face="
Times New Roman
"><font face="
Times New Roman
"><font size="4"><font face="
Times New Roman
"><font face="
Times New Roman
"><font face="
Times New Roman
"><font face="
Times New Roman
">some other operation<font face="
Times New Roman
">s </font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font></font>based on these similar names<font face="
Times New Roman
"> <font face="
Times New Roman
">since <font face="
Times New Roman
">(<font face="
Times New Roman
">"iz"+<font face="
Times New Roman
">i) can't be identified as a<font face="
Times New Roman
"> variable</font></font></font></font></font></font></font></font></font> in the following script.<font size="4"><font face="
Times New Roman
"><font face="
Times New Roman
"><font size="4"><font face="
Times New Roman
"><font face="
Times New Roman
"> </font></font></font></font></font></font><font size="4"><font face="
Times New Roman
"><font face="
Times New Roman
"><font size="4"><font face="
Times New Roman
"><font face="
Times New Roman
"> </font>Can anyone help?</font></font></font><font face="
Times New Roman
"><font face="
Times New Roman
"><font face="
Times New Roman
"><font face="
Times New Roman
"><font face="
Times New Roman
"><br>..............................<wbr>...................<font face="
Times New Roman
">...........<wbr>..............................<wbr>...........................</font><br></font></font></font></font></font></font></font> <br>fieldf(0,:) = asciiread(fi,-1,"<font face="
Times New Roman
">float</font>")<br> iz1=ind(fieldf(0,:).ge.0.and.<wbr>fieldf(0,:).lt.1.5) <br> iz2=ind(fieldf(0,:).ge.1.and.<wbr>fieldf(0,:).lt.2.2) <br> iz3=ind(fieldf(0,:).ge.2.<font face="
Times New Roman
">2</font>.<wbr>and.fieldf(0,:).lt.3)<br> iz4=ind(fieldf(0,:).ge.3.and.<wbr>fieldf(0,:).lt.4.2) <br> iz5=ind(fieldf(0,:).ge.4.2<font face="
Times New Roman
">.</font>and<wbr>.fieldf(0,:).lt.5.6) <br> iz6=ind(fieldf(0,:).ge.5.6.<wbr>and.fieldf(0,:).lt.6) <br> iz7=ind(fieldf(0,:).ge.6.and.<wbr>fieldf(0,:).lt.7) <br> iz8=ind(fieldf(0,:).ge.7.and.<wbr>fieldf(0,:).lt.8) <br> iz9=ind(fieldf(0,:).ge.8.and.<wbr>fieldf(0,:).lt.9.1) <br> iz10=ind(fieldf(0,:).ge.9.<font face="
Times New Roman
">1<font face="
Times New Roman
">.</font></font>an<wbr>d.fieldf(0,:).lt.10) <br> iz11=ind(fieldf(0,:).ge.10.<wbr>and.fieldf(0,:).lt.11) <br> iz12=ind(fieldf(0,:).ge.11.<wbr>and.fieldf(0,:).lt.12) <br> iz13=ind(fieldf(0,:).ge.12.<wbr>and.fieldf(0,:).lt.13) <br><br> do i=<font face="
Times New Roman
">1</font>,1<font face="
Times New Roman
">3</font><br> print(dimsizes("iz"+i))<br> end do<br><font face="
Times New Roman
">..............................<wbr>..............................<wbr>..................</font><font size="4"><font face="
Times New Roman
">............<wbr>..........<br> <br>Thanks very much,<br> <br><font face="
Times New Roman
">Zoey</font></font></font><br><br>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/<wbr>mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>