[ncl-talk] convert string to variable name

Zhifeng Yang yangzf01 at gmail.com
Fri Aug 28 09:58:59 MDT 2015


Hi

I wanted to change variable names through strings. Since I use the similar
property while I read variable from .nc file. For instance,
a = "var"
b = addfile(filename + ".nc", "r")
c = b->$a$
In this case, I can change a to change the variable names.

Now I wanted to use the similar feature to modify variable names. For
instance,
a is a string,
a = "var"

b is a variable. I want to modify b by using
b = $a + "a01"$

Unfortunately, I got the error below.

fatal:syntax error: line 1 before or near $
b = $

Do you know whether these is any way to change the variable name like what
I want?

Thank you
Zhifeng
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150828/160bc716/attachment.html 


More information about the ncl-talk mailing list