MathGroup Archive 2004

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

Search the Archive

Re: Re: Subject: Calling one notebook into another

  • To: mathgroup at
  • Subject: [mg52318] Re: [mg52290] Re: Subject: [mg52318] [mg52290] Calling one notebook into another
  • From: DrBob <drbob at>
  • Date: Mon, 22 Nov 2004 01:28:54 -0500 (EST)
  • References: <>
  • Reply-to: drbob at
  • Sender: owner-wri-mathgroup at

I tried your code in version 5.1, and it didn't like the SetDirectory command:


Cannot set current directory to `1`.

Here's my home directory:


C:\Documents and Settings\bobby

and here's a command that DOES work:

SetDirectory["C:\\Documents and Settings\\bobby\\Desktop"];

Is this a bug?


On Sun, 21 Nov 2004 07:23:26 -0500 (EST), Bill Rowe <readnewsciv at> wrote:

> On 11/20/04 at 3:41 AM, tftn at (Roger Bagula) wrote:
>> I am have a for loop running in one notebook file which
>> needs some calculations to be done every time it starts over. I
>> made a second notebook which does these calculations and tried to
>> call it into the first one by initializing the cell and using the
>> save as special>Package Format. Then tried to call it into the
>> first notebook with the command <file.m.
>> This didn't work for me is there anyway in Mathematica
>> where we call a subroutine which carries some value with it each
>> time like in C-Language.
> Putting things in a .m file to use in another notebook should work fine. You did not supply any details as to exactly what you did. Consequently, there is no way for me to know what it wrong.
> But maybe a very simple example of this working will help.
> First, I entered 2 Gamma[.6] into a fresh session, made the cell an initialization cell, saved the notebook using Save As Special->Package Format then quite Mathematica to start a fresh session as follows:
> In[1]:= $Version
> Out[1]= "5.0 for Mac OS X (June 10, 2003)"
> In[2]:= SetDirectory["~/Desktop"];
> In[3]:= !!test.m
>    a = 2 Gamma[.6]
>    (*
>    2.97838
>    *)
> (* the above is only to show the contents of the .m file created *)
> In[4]:=a
> Out[4]=a
> (* showing a is not defined *)
> In[5]:=<< "test.m"
> Out[5]=2.978384497625634
> In[6]:=a
> Out[6]=2.978384497625634
> (* showing a is now defined as expected *)
> In[7]:=Total[Table[<< "test.m", {5}]]
> Out[7]=14.89192248812817
> (* showing <<test.m will work in a loop *)
> The only thing I can see I did differently from what you posted is I used "<<test.m" rather than "<test.m". I am assuming your "<test.m" is a typo since Mathematica should complain about <test.m
> --
> To reply via email subtract one hundred and four

DrBob at

  • Prev by Date: Re: Re: Re: Newly Released Mathematica 5.1 Delivers Unmatched Performance for Handling Data
  • Next by Date: UnitStep
  • Previous by thread: Re: Subject: Calling one notebook into another
  • Next by thread: Re: Subject: Calling one notebook into another