Re: How to make variables local to a particular notebook?
- To: mathgroup at smc.vnet.net
- Subject: [mg101822] Re: How to make variables local to a particular notebook?
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Sat, 18 Jul 2009 04:51:01 -0400 (EDT)
On 7/17/09 at 5:02 AM, dnquark 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.