[ncl-talk] dynamic variable names

Milinski, Sebastian sebastian.milinski at mpimet.mpg.de
Thu Feb 4 03:30:27 MST 2016


Hi,

I would like to access a variable. The name of the variable to be accessed is created from user input (string) and a suffix (string)

user_selection = "ALL"
dynvar 		= user_selection + "index"
var1			= dynvar 					; <- here I do not want the string ALLindex but the content of ALLindex.
print(var1)


The syntax var1 = $dynvar$ does not work. Is there an easy way to do this without several if-statements?

Thanks,
Sebastian

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 842 bytes
Desc: Message signed with OpenPGP using GPGMail
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160204/7add1b2d/attachment.bin 


More information about the ncl-talk mailing list