I have a notebook which contain all the variables and defined functions. I want to do two tasks. As an example, I want to find the density and energy which have equations in terms of above mentioned variables and functions. If I write one code for these two tasks, it is a very large notebook. So, if I have separate notebooks for "variables and functions",density and energy, how can I connect each notebook so that they can run properly and give the result? Could anyone please help me to do this?
1
-
1$\begingroup$ Can you be more specific about the nature of your"variables and functions"? How huge are we talking? You might be able to place them in a .m file and read that in. Or you might be able to place them in an initialization cell in a separate (collapsed) section in the same notebook. A little more information might help. $\endgroup$ – Mark McClure Mar 27 '13 at 21:34
Add a comment
|
$\begingroup$
$\endgroup$
1
If you open and evaluate the 'functions and variables' notebook and then evaluate the second (or third or fourth) notebook everything should work fine. You can use Names[$Context <> "*"]
to see what variables and functions have been defined in the current session.
E.g:
In[1]:=
a = blah;
b = blah;
c = blah;
{a, b, c}
Out[4]= {blah, blah, blah}
In[5]:= Names[$Context <> "*"]
Out[5]= {"a", "b", "blah", "c"}
More detail here.