MathGroup Archive 2008

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

Search the Archive

Re: Assignment problem

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

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

>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