Is there a way to clear everything before starting in Mathematica?

前端 未结 3 1952
面向向阳花
面向向阳花 2021-02-04 06:03

In MATLAB there is the function clear to delete all current variables. This is very useful if you start something totally new and don\'t want to get conflicts with earl

3条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-04 07:04

    You can use ClearAll to clear the variables and their attributes in your Global context (default) like so:

    ClearAll["Global`*"]
    

    If you're working inside a different context (e.g., notebook specific context or cell group specific context), you can do

    ClearAll[Evaluate[Context[] <> "*"]]
    

    If you want to remove all symbols from the kernel so that Mathematica doesn't recognize them anymore, you can use Remove[] similar to the above two examples.

    Barring these, you can always quit the kernel with Quit[] which will remove all symbols. A fresh kernel will be initiated the next time you evaluate something.

提交回复
热议问题