Skip to main content
12 events
when toggle format what by license comment
Nov 1, 2012 at 9:58 history tweeted twitter.com/#!/StackMma/status/263943136282288129
Nov 1, 2012 at 8:39 vote accept CommunityBot
Nov 1, 2012 at 8:39 comment added user246 @b.gatessucks I'll try that. I had not considered using Manipulate.
Nov 1, 2012 at 8:36 comment added b.gates.you.know.what Would you consider using Manipulate like in Manipulate[ s = ToExpression[StringReplace[list, {"(" -> "{", ")" -> "}"}]]; ListPlot[s, PlotStyle -> PointSize[0.05], PlotRange -> All], {{list, "((5, 6), (9, 0))", "Data points"}, "((5, 6), (9, 0))"}] ?
Nov 1, 2012 at 8:33 comment added jVincent @YequalsX see my answer, you need the dynamics to wrap the expressions that you want to be dynamicly updated.
Nov 1, 2012 at 8:32 comment added user246 I've put the Dynamic in every conceivable location and it won't work. I'm getting an error in the ListPlot. It says that s is not a list whenever I have Dynamic. No matter what level I put Dynamic at.
Nov 1, 2012 at 8:31 answer added jVincent timeline score: 7
Nov 1, 2012 at 8:27 comment added jVincent @YequalsX Dynamic is a wrapper that the front end handles, so you can't just act like it's the same as the variable. Doing anything like Dynamic[{1,2,3}][[1]] or Sin[Dynamic[x]] will not work. What you should do is to keep the wrapper on the outer level, and put your operations inside, e.g: Dynamic[{1,2,3}[[1]]] and Dynamic[Sin[x]].
Nov 1, 2012 at 8:25 history edited user246 CC BY-SA 3.0
deleted 74 characters in body
Nov 1, 2012 at 8:22 comment added user246 You are correct. I had those in there because I started out using Dynamic[list] and Dynamic[s] and kept getting errors. For instance, StringReplace[Dynamic[list].....] gives and error. I'll clean the code. But the question remains, how can I make it dynamic?
Nov 1, 2012 at 8:17 comment added b.gates.you.know.what You don't need ToString[] and ToExpression (inside ListPlot). This works : DynamicModule[{list = "((5, 6), (9, 0))", s}, Panel[Column[{Labeled[ InputField[Dynamic[list], String, FieldSize -> {50, 5}], StringForm["Data Points"], Left], s = ToExpression[StringReplace[list, {"(" -> "{", ")" -> "}"}]], StringQ[s], s, ListPlot[s, PlotStyle -> PointSize[0.05]]}]]]/
Nov 1, 2012 at 7:52 history asked user246 CC BY-SA 3.0