Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive

MathGroup Archive 2008

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

Search the Archive

Re: Variable question

  • To: mathgroup at
  • Subject: [mg92517] Re: Variable question
  • From: Bill Rowe <readnews at>
  • Date: Thu, 2 Oct 2008 04:37:03 -0400 (EDT)

On 10/1/08 at 6:29 PM, Johney at wrote:

>I have the following test code

>c = 3
>var = "c"
>v = StringTake[var, {1}]

>v is showing up as c but I want it to show up as 3.  Is there a way
>to do this?

Since "c" is a one character long string, v = StringTake[var,
{1}] returns the single character c and assigns it to v.

Simply doing

v = c

causes Mathematica to evaluate c to 3 and assign this to v.

But, since the above seems very obvious, I assume there is
something else you want to do here. If you provide more detail
as to your ultimate goal someone likely can give you a better answer.

  • Prev by Date: Re: Variable question
  • Next by Date: Re: Variable question
  • Previous by thread: Re: Variable question
  • Next by thread: Re: Variable question