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

MathGroup Archive 2009

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

Search the Archive

Re: Output from a Dynamic Module

  • To: mathgroup at smc.vnet.net
  • Subject: [mg97762] Re: Output from a Dynamic Module
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Sat, 21 Mar 2009 05:14:52 -0500 (EST)
  • Organization: Uni Leipzig
  • References: <gpvhaj$gsm$1@smc.vnet.net>
  • Reply-to: kuska at informatik.uni-leipzig.de

Hi,

SetAttributes[SaveThePoints, HoldAll]
SaveThePoints[pnts_] :=
  DynamicModule[{pts}, pts = {{0, 0}, {1, 0}, {2, 0}, {3, 0}};
   Column[{Button["Assign points", pnts = pts],
     LocatorPane[Dynamic[pts],
      Dynamic[Plot[Interpolation[pts][x], {x, 0, 3}, Frame -> True,
        Axes -> False, PlotRange -> {All, {-1, 1}},
        ImageSize -> 7 72]]]}]]


and

SaveThePoints[p]

will save it to th variable p.

Regards
   Jens

Hugh Goyder 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"]
> 


  • Prev by Date: Using findroot and NIntegrate with a double integral
  • Next by Date: Re: Mathematica Graphics - speed bottleneck
  • Previous by thread: Re: Output from a Dynamic Module
  • Next by thread: Re: Output from a Dynamic Module