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

MathGroup Archive 2008

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

Search the Archive

Re: Assignment problem

  • To: mathgroup at smc.vnet.net
  • Subject: [mg86289] Re: Assignment problem
  • From: Bill Rowe <readnewsciv at sbcglobal.net>
  • Date: Fri, 7 Mar 2008 02:32:36 -0500 (EST)

On 3/6/08 at 2:58 AM, m.gabiccini at ing.unipi.it (Marco Gabiccini)
wrote:

>I would like to do something like:

>For[ i=1, i<n, i++, ToExpression[ "q" <> ToString[i] ] = 0 ]

>that is assigning q1=0, q2=0, etc... but it does not work.

This will do what you want assuming the variables don't already exist

Table[Set[Evaluate@ToExpression["q" <> ToString[n]], 0], {n, 0, 4}];
--
To reply via email subtract one hundred and four


  • Prev by Date: animate-graphics
  • Next by Date: "If" tests inside call to Graphics3D
  • Previous by thread: Re: Assignment problem
  • Next by thread: Re: Assignment problem