Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

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

Search the Archive

Re: Variable question

  • To: mathgroup at smc.vnet.net
  • Subject: [mg92510] Re: Variable question
  • From: Szabolcs Horvát <szhorvat at gmail.com>
  • Date: Thu, 2 Oct 2008 04:35:36 -0400 (EDT)
  • Organization: University of Bergen
  • References: <gc0tkn$9ci$1@smc.vnet.net>

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