Re: update notebook calculations on startup?
- To: mathgroup at smc.vnet.net
- Subject: [mg100205] Re: update notebook calculations on startup?
- From: dbreiss at gmail.com
- Date: Thu, 28 May 2009 04:27:45 -0400 (EDT)
- References: <gvdr7p$73d$1@smc.vnet.net>
On May 25, 6:17 am, donkey <psilo_n... at hotmail.com> wrote: > 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"], > FinancialData[stock2, "Jan. 1,2009"]}, Joined -> True, > PlotLabel -> "Blue -> " + stock1 + "Red -> " + stock2, > 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! One possibility is to encapsulate your code as a Dynamic item (simplest example is in a Manipulate, but using more general Dynamic functionality allows much more creativity) with an appropriate Refresh. This has been covered in this group at times in the past (I don't have time to give an example right now ---yes Fermat Lives!). But such an approach can cause your example to automatically update at a specified interval. Sorry for the brevity of this comment... --David