I just changed my default notebook context to 'unique to this Notebook' so that variables don't roll across numerous open notebooks. Doing this, however, made the command ClearAll["Global*"] stop working to clear all declared variables. I also tried, ClearAll[Evaluate[Context[] <> "*"]], but that didn't work either. Any ideas?
Asked
Active
Viewed 709 times
8
DilithiumMatrix
- 582
- 4
- 12
2 Answers
8
As soon as you set your notebook context to 'unique to this Notebook', the notebook's context is no longer Global`, but, well, unique to the notebook.
I can't test right now, but assuming you are not in an explicitly opened context (like after Begin or BeginPackage), I think the following should work:
ClearAll@@{$Context<>"*"}
At least it works in a kernel with manually changed $Context.
celtschk
- 19,133
- 1
- 51
- 106
3
I think instead of ClearAll["Global`*"], you can just Clear["`*"]. This should work.
Kuba
- 136,707
- 13
- 279
- 740
Consideration
- 109
- 6
ClearAll@"`*"... – rm -rf May 31 '13 at 03:21