Re: How to make variables local to a particular notebook?
- To: mathgroup at smc.vnet.net
- Subject: [mg101876] Re: How to make variables local to a particular notebook?
- From: David Reiss <dbreiss at gmail.com>
- Date: Mon, 20 Jul 2009 06:02:43 -0400 (EDT)
- References: <firstname.lastname@example.org>
In the specified Notebook execute SetOptions[EvaluationNotebook, CellContext -> "GlobalA`"] Where i am using GlobalA` a the Notebook's context in this example case... Hope this helps. --David http://scientificarts.com/worklife On Jul 18, 4:45 am, Bill Rowe <readn... at sbcglobal.net> wrote: > On 7/17/09 at 5:02 AM, dnqu... at gmail.com (dnquark) wrote: > > >In the Evaluation menu I see the "Notebook's Kernel" and "Notebook's > >default context" items. So I am wondering what is the preferred > >method for making sure variables in a particular notebook stay > >private to that notebook -- to assign the notebook to a different > >kernel or to give it a different context?.. > > Assigning a different kernel to a notebook does not make > variables in that notebook private to that notebook. Any other > notebook linked to the same kernel will also see those > variables. Additionally, there is a limit to how many kernels > you can run as determined by your Mathematica license. > > The only way to truly make variables private to a given notebook > I know of is to use a different context for the notebook. > > >Also, whatever method I choose -- what command could I evaluate at > >the first cell in the notebook to make sure that the context or the > >kernel is changed before the rest of the notebook gets evaluated?.. > > When you specify a different kernel to be used with a notebook, > that information is saved when the notebook is saved. The next > time the same notebook is used the kernel will be the same as > what you specified before. I assume the same is true for > contexts. However, I've not needed to do this and have not tried > it to see if that is the case.