MathGroup Archive 2009

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

Search the Archive

Re: Inputting Dynamic Variables

  • To: mathgroup at smc.vnet.net
  • Subject: [mg103061] Re: Inputting Dynamic Variables
  • From: Harutyun Amirjanyan <amirjanyan at gmail.com>
  • Date: Sun, 6 Sep 2009 07:37:55 -0400 (EDT)
  • References: <h7tbho$fvi$1@smc.vnet.net>

you may use method similar to the one used for bookmarks in manipulate

here is simple example

ClearAll[a, b, c];
vals := {a = 4, b = 3, c = 4};
Save[NotebookDirectory[] <> "\\1.val", vals]
vals := {a = 5, b = 3, c = 4};
Save[NotebookDirectory[] <> "\\2.val", vals]
ReSet[] :=
 DynamicModule[{},
  Dynamic[TableForm[Table[InputLine[pp[][[i]]], {i, Length[iv]}]]]]
InputLine[{p_, q_}] :=
 DynamicModule[{t},
  ReleaseHold[Row[{p, InputField[Dynamic[t]]}] /. t :> q]]
ButtonReSet[] := Button["reset values", vals]
ButtonBrowse[] :=
 Button["browse for New values",
  With[{xfile = SystemDialogInput["FileOpen",
      {NotebookDirectory[], {"val file" -> {"*.val"}}},
      WindowTitle -> "load your settings..."]},
   If[xfile =!= $Canceled, Get[xfile]; vals]], Method -> "Queued"]
F[] := DynamicModule[{}, Dynamic[Plot[a x^2 + b x + c, {x, -1, 1}]]]
ClearAll[pp, a, b, c];
iv = {a, b, c};
pp[] := {{"coff a ", Hold[a]}, {"coff b ", Hold[b]}, {"coff c ",
    Hold[c]}};
vals := {a = 2, b = 3, c = 4};
Dynamic[#] & /@ iv
ReSet[]
F[]
Row@{ButtonReSet[], ButtonBrowse[]}


  • Prev by Date: Re: upwind scheme in Mathematica?
  • Next by Date: Re: Manipulate: How to correctly adjust one control parameters based on current setting of another control?
  • Previous by thread: Re: Inputting Dynamic Variables
  • Next by thread: Re: random variable