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: [mg58319] Re: Clear subscripted variables
  • From: "Jens-Peer Kuska" <kuska at>
  • Date: Tue, 28 Jun 2005 05:13:19 -0400 (EDT)
  • Organization: Uni Leipzig
  • References: <d9ispk$cpd$>
  • Sender: owner-wri-mathgroup at


ClearSubscript[x_Symbol] := (First /@
Verbatim[HoldPattern][Subscript[x, _]]] &]) /.
      HoldPattern :> Unset


ClearSubscript[x] will remove all Subscript[x,_] 



"Mukhtar Bekkali" <mbekkali at> schrieb im 
Newsbeitrag news:d9ispk$cpd$1 at
> 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

  • Prev by Date: Optimal number of sheets
  • Next by Date: Re: Re: Mathematica Visualization site - update
  • Previous by thread: Re: Clear subscripted variables
  • Next by thread: Re: Re: Mathematica program generating sequence ofpoints stalls for no apparent reason.