Re: Including Functions and Variables from another Notebook
- To: mathgroup at smc.vnet.net
- Subject: [mg6806] Re: [mg6786] Including Functions and Variables from another Notebook
- From: Allan Hayes <hay at haystack.demon.co.uk>
- Date: Mon, 21 Apr 1997 01:59:09 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
>From: "Rick A. Sprague" <sprague at egr.msu.edu> >[mg6786] Including Functions and Variables from another Notebook > Can someone tell me how to include functions and variables from > another notebook? I have written a notebook that contains > functions that detemine pure component thermodynamic properties > given certain parameters, ie: heat capacity, vapor pressure, etc. > Now I want to use those functions and apply them to a new notebook > that models vapor liquid equilibrium. I want to use these > functions with out cutting and pasting cells into my new notebook. Rick: In Mma 3.0 we can do the following sort of thing (1) Automatically save you definitions in a package: Make a definition (you need not evaluate it) double[x_]:= {x,x} Select this cell; make it an initialization cell (use Cell/Cell Properties/ Initialization Cell) Save notebook, including the following steps in the procedure: name it MGExample, click to save (you will get a panel asking if you wish to make a package containing all the initialization cells); click Create. (2) Test that this works Open a new notebook Clear[double] (*to ensure that double is not defined*) <<MGExample` double[5] {5,5} Allan Hayes hay at haystack.demon.co.uk http://www.haystack.demon.co.uk