Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

Re: Clear subscripted variables

  • To: mathgroup at
  • Subject: [mg58292] Re: Clear subscripted variables
  • From: David Bailey <dave at>
  • Date: Sun, 26 Jun 2005 01:33:54 -0400 (EDT)
  • References: <d9ispk$cpd$>
  • Sender: owner-wri-mathgroup at

Mukhtar Bekkali wrote:
> Here is the code (x\_i stands for x subscript i):
> Table[{Print[x\_i = i]; Clear[x]; Remove[x]; Unset[x]; Print[x\_i]},
> {i, 1, 2}]
> I expected that x\_i is cleared at the end of the loop but it isn't
> If I insert Clear[Subscript] in the loop then it is cleared, but not
> desirable since it clears all variables with subscripts.
> What command shall I use to clear specific subscripted variables?
> Mukhtar Bekkali

Try this:

Table[a\_i =. , {i, 1, 10}]

This is equivalent to the use of Unset[a\_i]

David Bailey

  • Prev by Date: Re: Re: Solve with assumptions
  • Next by Date: Re: Solve with assumptions
  • Previous by thread: Re: Clear subscripted variables
  • Next by thread: Re: Clear subscripted variables