Re: Newbie Programming question
- To: mathgroup at smc.vnet.net
- Subject: [mg53440] Re: Newbie Programming question
- From: "Jens-Peer Kuska" <kuska at informatik.uni-leipzig.de>
- Date: Wed, 12 Jan 2005 03:41:10 -0500 (EST)
- Organization: Uni Leipzig
- References: <crvtn6$144$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi, newVariable[pre_String, i_Integer] := ToExpression[pre <> ToString[i]] Evaluate[newVariable["foo", 14]] = 15 ?? Regards Jens "Kerry Kim" <kjkim at u.washington.edu> schrieb im Newsbeitrag news:crvtn6$144$1 at smc.vnet.net... > Hello, > > Is there any way in Mathematica to store/assign a value to a variable > whose name is in a string? In other words something like this: > > i = 17; > foo="var" + ToString[i]; > SomeFunctionThatConvertsStringToSymbolName[foo] = 17; > > and then assign some value (say, 23) to the variable whose name is > contained in the foo string? (i.e. var17=23) > > Thanks! >