MathGroup Archive 2008

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

Search the Archive

Re: Assignment problem

  • To: mathgroup at smc.vnet.net
  • Subject: [mg86267] Re: [mg86219] Assignment problem
  • From: "Curtis F. Osterhoudt" <cfo at lanl.gov>
  • Date: Fri, 7 Mar 2008 02:28:28 -0500 (EST)
  • References: <200803060758.CAA29197@smc.vnet.net>
  • Reply-to: cfo at lanl.gov

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


  Hope that helps!


> Hi all,
>
> 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.
>
> I would not like to use the easy way out:
>
> For[ i=1, i<n, i++, q[i] = 0 ]
>
> of employing q[i] instead of qi.
>
> Can you help me please?
>
> Thanks,
>
> Marco
>
> Ing. Marco Gabiccini, PhD
> Assistant Professor of Applied Mechanics
> Dept. of Mechanical, Nuclear and Production Engineering
> University of Pisa
> Via Diotisalvi, 2, 56126 Pisa (PI) - Italy
> Phone: +39-050-836.676
> E-mail: m.gabiccini at ing.unipi.it
>
>
>



  • Prev by Date: Re: Assignment problem
  • Next by Date: Re: Assignment problem
  • Previous by thread: Re: Assignment problem
  • Next by thread: Re: Assignment problem