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

MathGroup Archive 2008

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

Search the Archive

Running Notebooks inside a notebook:

  • To: mathgroup at smc.vnet.net
  • Subject: [mg91063] Running Notebooks inside a notebook:
  • From: Gopinath Venkatesan <gopinathv at ou.edu>
  • Date: Tue, 5 Aug 2008 04:01:30 -0400 (EDT)

Hi Mathematica Friends,

I wanted to execute a notebook inside a notebook. Say I have a notebook "Outer.nb" and "Inner.nb". I tried to do it using NotebookOpen[], Please see the code in the bottom for the same.

Inner.nb has a list of data input and commands and then outputs. Now I want to put this Inner.nb inside a Do[] loop in the Outer.nb, such that for each loop increment, I could change the input of the Inner.nb, and as well as write the output to a separate file (say Excel), or variable. Here it opens the notebook but doesn't do any calculations.

One thing to note here is the parameters vel,nmx,n are all needed for successful execution of Inner.nb but I hope that because the kernel remembers these values from Outer.nb, I did not include them in the Inner.nb. Moreover, I wanted to access these from Outer.nb because I wanted to change these values in the loop.

*******************************
(* Code starts here -- This is Outer.nb file *)
vel = 20;
nmx = 3;
n = 31;
set = {};
While[0 <= vel <= 40,
  file = "G:/somefolder/Inner.nb";
  nb = NotebookOpen[file, Visible -> True]; (* True/False visible/hidden does not matter for me *)
  SelectionMove[nb, All, Notebook];
  SelectionEvaluate[nb];
  set = Append[set, newc];
  vel = 1.5 vel;
  NotebookClose[nb]];
set // MatrixForm

(* Code ends here *)

If you have an example or pointer to the documentation, please share it here. Thank you.

Regards,

Gopinath


  • Prev by Date: Re: Incoherent value for partial derivative
  • Next by Date: Derivative of Dot[]
  • Previous by thread: Re: How to get objects closer to each other in a Graphics Grid?
  • Next by thread: Re: Running Notebooks inside a notebook: