MathGroup Archive 2008

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

Search the Archive

Re: Variable question


Johney at giganews.com wrote:
> I have the following test code
> 
> c = 3
> var = "c"
> v = StringTake[var, {1}]
> v
> 
> 
> v is showing up as c but I want it to show up as 3.  Is there a way to do this?
> 

Converting strings to variable names became awfully popular the last few 
days ...

Try Symbol[var] or ToExpression[var], but keep in mind that resorting to 
methods like this is always never necessary in Mathematica.


  • Prev by Date: Re: Simplifying Bessel Functions
  • Next by Date: Re: Variable question
  • Previous by thread: Re: Variable question
  • Next by thread: Re: Variable question