Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

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

Search the Archive

Re: update notebook calculations on startup?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg100157] Re: [mg100121] update notebook calculations on startup?
  • From: "David Park" <djmpark at comcast.net>
  • Date: Tue, 26 May 2009 05:12:26 -0400 (EDT)
  • References: <10498262.1243247878783.JavaMail.root@n11>

Make the cells you want to be automatically evaluated Initialization cells.
You do this be selecting them and then using Menu -> Cell -> Cell Properties
-> Initialization Cell. Or use Alt-CPI.

When you first save the notebook you will be asked if you want it saved as
an AutoGenerated Package. Answer NO. (That would generate a .m package file,
which you don't want. You just want the initialization cells to be evaluated
when you open the notebook.)

So far, what this will do is cause a pop-up window to ask if you want the
initialization cells evaluated when you first try to evaluate any cell in
the notebook. What you want is for the initialization cells to be
automatically evaluated when the notebook is opened. To get that open the
Options Inspector (Shift-Ctrl-O), set the selection in Show option values to
your notebook, and go to Notebook Options, Evaluation Options. Then set
InitializationCellEvaluation to True and InitializationCellWarning to False.
Then change Show option values to Global Preferences and set
GlobalInitializationCellWarning to False. (Otherwise you will obtain a
pop-up window on opening the notebook asking if you want to evaluate the
initialization cells.)

Then the desired cells will be automatically evaluated on opening the
notebook.

Another possibility is to put all of the cells you want to initialize in one
Section of the notebook, without making them initialization cells. Then
select the entire section and evaluate it when you open the notebook. This
isn't automatic but it is fairly easy.


David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/ 



From: donkey [mailto:psilo_naut at hotmail.com]

I'm using mathematica to do some calculations on financial data and want to
know if there is a way to make the calculations execute automatically when I
notebook is open.

For example I have a notebook with the following code:
stock1 = "ASX:RHC"

stock2 = "ASX:PRY"

currentDate = {2009, 5, 21}

correlationOffset = -150

DateListPlot[{FinancialData[stock1, "Jan.1,2009"],
=C2  FinancialData[stock2, "Jan. 1,2009"]}, Joined -> True,
=C2 PlotLabel -> "Blue -> " + stock1 +=C2  "Red -> " + stock2,
=C2 FrameLabel -> {"Date", "Closing Price"}]

I would like it to update the graph automatically rather than me having to
go through and shift+enter on each of the lines.

Cheers!




  • Prev by Date: Re: list manipulation
  • Next by Date: Re: Basic question about Mathematica Interface
  • Previous by thread: Re: update notebook calculations on startup?
  • Next by thread: Re: update notebook calculations on startup?