Re: How to convert string to variable name
- To: mathgroup at smc.vnet.net
- Subject: [mg39866] Re: How to convert string to variable name
- From: Bob Harris <NspamITmeLION at MINDnotSPRING.COM>
- Date: Sun, 9 Mar 2003 05:28:44 -0500 (EST)
- References: <b49n66$fdc$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
I wrote: >> ... for a given string, how can I assign to the variable whose name is >> defined by that string? and Hermann Schmitt replied: > I would do it the following way: > ToExpression["z = ....."]; Thanks, that appears to be what I want. I just have to build a string that contains the entire assignment. A couple people suggested using Symbol[], but I don't see how that would work. For example, Symbol["x"] = 13 doesn't create a symbol x with value 13. Instead, it simply produces an error message informing me that "Tag Symbol in Symbol["x"] is Protected." Thanks, Bob H