Re: Converting a string to a variable name
- To: mathgroup at smc.vnet.net
- Subject: [mg90336] Re: Converting a string to a variable name
- From: "David Park" <djmpark at comcast.net>
- Date: Sun, 6 Jul 2008 07:19:37 -0400 (EDT)
- References: <g4ncqd$gh8$1@smc.vnet.net>
The following will work, but you must make certain the variables are cleared before making the assignments. Clear @@ Table["Var" <> ToString[i], {i, 1, 10}] Do[Evaluate[Symbol["Var" <> ToString[i]]] = i^2, {i, 1, 10}] {Var1, Var5, Var10} {1, 25, 100} -- David Park djmpark at comcast.net http://home.comcast.net/~djmpark/ "Aaron Fude" <aaronfude at gmail.com> wrote in message news:g4ncqd$gh8$1 at smc.vnet.net... > Hi, > > Is it possible to create a variable whose name is contained in another > variable or a string, something along the lines of > > Table[ a="Var"<>ToString[i]; Variable[a] = i^2, {i, 1, 10}] > > and end up with variables Var1, ..., Var10? > > Thanks! > > Aaorn >