MathGroup Archive 2008

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

Search the Archive

RE: Re: Executing an external notebook within another notebook

  • To: mathgroup at smc.vnet.net
  • Subject: [mg93041] RE: [mg93003] Re: Executing an external notebook within another notebook
  • From: "Tugrul Temel" <temelt at xs4all.nl>
  • Date: Fri, 24 Oct 2008 02:32:21 -0400 (EDT)
  • References: <gdja5r$ieh$1@smc.vnet.net> <200810220940.FAA00757@smc.vnet.net>

Dear All,

Finally, following the suggestions of Horvat (thanks go to him and David
Park), I have solved the problem of executing an external notebook within
another notebook. For those who still wait for the answer to this problem I
am summarizing the main steps involved.

1) I strongly suggest to create a Mathematica Package (using BeginPackage[]
and EndPackage[] statement. This was the key for the solution to the
problem. 

2) Once you create a package then you recall this package into the main
notebook using Get["filename`"].

3) Before you use the GET command, you should set the directory to the
directory where the package is.

In case you like to know more on this topic, you may write me.

Regards,
Tugrul



-----Original Message-----
From: Szabolcs Horvat [mailto:szhorvat at gmail.com] 
Sent: Wednesday, October 22, 2008 11:41 AM
To: mathgroup at smc.vnet.net
Subject: [mg93041] [mg93003] Re: Executing an external notebook within another
notebook

Tugrul Temel wrote:
> Dear All,
> 
> Recently, the issue of executing a notebook within another notebook has
> arised and I worked on that for sometime. My progress has been limited and
> I am stuck at the following point.
> 
> 1) I wrote a generic "Common.nb" including the general code that can be
> executed using different data set.
> 2) I created another notebook "data.nb" retriving the data from Excel for
> calculations using the codes from "Common.nb"
> 3) I only open the "data.nb" and use Needs[] command to bring "Common.nb"
> to the current "nb" file, it gives a lot of errors.
> 4) If I only open the "Common.nb" and run it, it also gives errors.
> 5) However, if I open both "data.nb" and "Common.nb" and run them
> separately (the order of execution does not matter), then both programs
> run properly, giving the desired outcomes.
> 6) This shows that these two "nb" have somehow been linked to each other
> without my intention.
> 

I am not sure why this happens, just a note about point 3:

You cannot use Needs to read in a notebook.  Instead make the relevant 
cells in common.nb initialization cells, and save the notebook. 
Mathematica will offer to create an auto-save package for you (which 
will be called common.m).  Now you can use Get["common.m"].





  • Prev by Date: Re: partial Dividers?
  • Next by Date: Re: Controlling the order of evaluations
  • Previous by thread: Re: Executing an external notebook within another notebook
  • Next by thread: Re: Executing an external notebook within another notebook