MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

String as a variable name

  • To: mathgroup at
  • Subject: [mg100276] String as a variable name
  • From: "A. B." <functionalcoatings at>
  • Date: Sun, 31 May 2009 06:31:28 -0400 (EDT)

In a data analysis package I use often, a facility is provided for
substituting a string for the name of a variable. Quoting from the user

"String Substitution Using $:
Wherever Igor expects the literal name of an operand, such as the name of a
wave, you can instead provide a string expression preceded by the $
character. The $ character tells Igor to evaluate the string expression and
substitute that value as the name it expected."

For example, I can write:

the variable whose name is variable1 would then be assigned the value 10.

I was looking for an equivalent in Mathematica. I tried looking into the
Symbol function, but haven't found a way to use it for this purpose. Thus,
something like:


does not work.

I sometimes need to create variables during the execution of a program whose
names are made up from concatenated strings and I need to be able to assign
values to them.

Any idea ?


  • Prev by Date: Re: How can I get the previous Fibonacci calculated
  • Next by Date: Indexed Slot in a Rule - How to do it??
  • Previous by thread: Re: How can I get the previous Fibonacci calculated
  • Next by thread: Re: String as a variable name