Re: Output from a Dynamic Module
- To: mathgroup at smc.vnet.net
- Subject: [mg97777] Re: Output from a Dynamic Module
- From: "Sjoerd C. de Vries" <sjoerd.c.devries at gmail.com>
- Date: Sat, 21 Mar 2009 05:18:32 -0500 (EST)
- References: <gpvhaj$gsm$1@smc.vnet.net>
Hugh, To start with your last question, the solution would be to remove the Dynamic from within the Export function. As to your main question: I guess you don't want to use a global variable? Indeed, that woud defeat the purpose of the module, i.e. to hide the variable pts from the global scope. I don't have an elegant solution. Perhaps copying pts to a global variable if it is your intention to hide pts? Cheers -- Sjoerd On Mar 20, 9:41 am, Hugh Goyder <h.g.d.goy... at cranfield.ac.uk> wrote: > In the toy example below I have a dynamic module where I adjust > Locator points to form a curve. When I have got a nice set of points > I would like to output them so that they can be used in other > calculations. I have provided a button to do this but can't see the > best way forward. Normally the output from a module is the last line > but here this is not possible. I give a bad method by using a > temporary file but what other methods are there? (And why does the > temporary file I import get up-dated even when I don't press the > button?) > Thanks > Hugh Goyder > > DynamicModule[{pts}, > pts = {{0, 0}, {1, 0}, {2, 0}, {3, 0}}; > Column[{ > Button["Assign points", Export["temp", Dynamic[pts], "List"]], > LocatorPane[Dynamic[pts], > Dynamic[ > Plot[Interpolation[pts][x], {x, 0, 3}, Frame -> True, > Axes -> False, PlotRange -> {All, {-1, 1}}, ImageSize -> 7 72= ]] > ] > }] > ] > > pp = Import["temp"]