Re: Subject: Calling one notebook into another
- To: mathgroup at smc.vnet.net
- Subject: [mg52290] Re: Subject: [mg52290] Calling one notebook into another
- From: Bill Rowe <readnewsciv at earthlink.net>
- Date: Sun, 21 Nov 2004 07:23:26 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
On 11/20/04 at 3:41 AM, tftn at earthlink.net (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
- Follow-Ups:
- Re: Re: Subject: Calling one notebook into another
- From: DrBob <drbob@bigfoot.com>
- Re: Re: Subject: Calling one notebook into another