Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mathematica, calling functions from another notebook

Is it possible to call functions from other notebooks in Mathematica, and if so how can I do it?

like image 822
John Avatar asked Jan 30 '12 18:01

John


1 Answers

Unless you specify otherwise, each notebook contributes to the Global` context. So, to call a function in notebook a from notebook b: first ensure that the definition is loaded into the context (i.e. select the cell with the definition and hit shift-enter), and then the definition is available to notebook b, and any other notebooks you have open.

To prevent this behavior, you can change the Notebook's Default Context from the Evaluation menu. There are four options: Global` (the default), another specified context, unique to the notebook, unique to the cell group. For the cell group, each input cell takes the context of the nearest enclosing group, e.g. a Subsection, for instance, and those groupings have unique contexts.

like image 64
rcollyer Avatar answered Oct 19 '22 21:10

rcollyer