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