Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Two Notebooks Open at the Same Time

  • To: mathgroup at smc.vnet.net
  • Subject: [mg97591] Re: Two Notebooks Open at the Same Time
  • From: nma <marxer at mec.li>
  • Date: Mon, 16 Mar 2009 04:25:17 -0500 (EST)
  • References: <gpg1eu$cjk$1@smc.vnet.net>

On 14 Mrz., 11:38, Gregory Lypny <gregory.ly... at videotron.ca> wrote:
> Hello everyone,
>
> Is it possible to have more than one notebook active at a time, that  
> is, so that the variables of one do not conflict with variables in  
> another whose names are the same.  I notice that when I open a  
> Mathematica 7 notebook, under the Evaluation menu, the Default Kernel  
> is local, the Notebook's Kernel is local, and the Notebook's Default  
> Context is global.  Do I need to change anything?
>
> Regards,
>
>         Gregory

Hello

I think that Mathematica is quite flexible with respect to contexts
and I hope the option "CellContext" (ref/CellContext in the Help
Browser) might help you.

You can choose
	1. an explicit context for a cell or a selection of cells (you
specify e.g. myContext`)
	2. a context unique to each cell in the selected notebook
	3. a context unique to each cell group (up one level) in the selected
notebook
	4. a context unique to the selected notebook

You can set the option CellContext using the menu item (Windows Vista,
Mathematica 7.0.1):
	"Evaluation" > "Notebook's Default Context"
		> Other ...    (you specify the context for the whole notebook)
		> Unique to Each Cell Group (up one level)
		> Unique to This Notebook
		> Global`     (Default)

You can set the option CellContext using the option inspector (Windows
Vista, Mathematica 7.0.1):
	"Format" > "Option Inspector ..."    lookup CellContext
		> Cell    (gives e.g. the following context Cell$$3671`)
		> Style    (gives e.g. Notebook$$24$63552624`)
		> CellGroup  (gives e.g. Cell$$5119`)
		> Notebook   (gives e.g. Notebook$$12`)

You can set the option CellContext for the whole notebook
programmatically with:
	SetOptions[EvaluationNotebook[], CellContext -> "myContext`"]

You can check the specified cell(s) context using the the Function:
	$Context

I hope this helps.

Best Regards
Norbert Marxer


  • Prev by Date: Re: How to map a list on function
  • Next by Date: Re: Two Notebooks Open at the Same Time
  • Previous by thread: Re: Two Notebooks Open at the Same Time
  • Next by thread: relaxation method for boundary value problem in systems of nonlinear ODEs