Re: Variable question
- To: mathgroup at smc.vnet.net
- Subject: [mg92517] Re: Variable question
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Thu, 2 Oct 2008 04:37:03 -0400 (EDT)
On 10/1/08 at 6:29 PM, 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?
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.