MathGroup Archive 2005

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

Search the Archive

Re: Clear subscripted variables


Hi,

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



and

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

Regards

  Jens

"Mukhtar Bekkali" <mbekkali at gmail.com> schrieb im 
Newsbeitrag news:d9ispk$cpd$1 at smc.vnet.net...
> 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.