<div dir="ltr"><div><div><div>Hi Zhifeng,<br></div>The short (unfortunate) answer is no, you cannot use dynamical variable names. This is a commonly requested feature. If you search for "dynamic variable naming" on the NCL website you will see a few of the ncl-talk queries on this subject and you can see if any of those responses can assist.<br></div>Hope that helps.<br></div>Adam<br><div><div><br><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Aug 28, 2015 at 9:58 AM, Zhifeng Yang <span dir="ltr"><<a href="mailto:yangzf01@gmail.com" target="_blank">yangzf01@gmail.com</a>></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><div><div><div><div><div><div><div><div><div><div>Hi <br><br></div>I wanted to change variable names through strings. Since I use the similar property while I read variable from .nc file. For instance, <br></div>a = "var"<br></div>b = addfile(filename + ".nc", "r")<br></div>c = b->$a$<br></div><div>In this case, I can change a to change the variable names.<br></div><div><br></div>Now I wanted to use the similar feature to modify variable names. For instance,<br></div><div>a is a string, <br></div>a = "var"<br><br></div><div>b is a variable. I want to modify b by using <br></div>b = $a + "a01"$<br><br></div>Unfortunately, I got the error below.<br><br>fatal:syntax error: line 1 before or near $ <br>b = $<br><br></div>Do you know whether these is any way to change the variable name like what I want?<br><br></div>Thank you<span class="HOEnZb"><font color="#888888"><br></font></span></div><span class="HOEnZb"><font color="#888888">Zhifeng<br></font></span></div>
<br>_______________________________________________<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/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div><div><span><font color="#888888">Adam Phillips <br></font></span></div><span><font color="#888888">Associate Scientist, </font></span><span><font color="#888888">Climate and Global Dynamics Laboratory, NCAR<br></font></span></div></div><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli/" target="_blank">www.cgd.ucar.edu/staff/asphilli/</a> </font></span><span><font color="#888888">303-497-1726 </font></span></div><span><font color="#888888"></font></span><div><div><span><font color="#888888"><br></font></span><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli" target="_blank"></a></font></span></div></div></div></div></div></div></div></div></div></div></div>
</div>