Message Boards Message Boards


Manipulate: how to save the value of a controller variable

Posted 9 years ago
1 Reply
0 Total Likes

Dear all,

I am using Manipulate on a graph to define custom key points on the x-axis defined by a vertical gridline which I move using the Manipulate functionality. Once I have found these points, I am currently having to press the "+" button which reveals the value of the variable and then I have to copy and paste it somewhere into a new array. It would be much more convenient if I could create an additional button in the Manipulate which when clicked would add the current variable's value to an array. Is there anyway to do this?

Thanks, David


I'm not entirely sure this answers your question, but here is a very simple example:

values = {}
Manipulate[Column[{x, Button["Add to values", values = Append[values, x];]}], {x, 0, 5}]

Every time the button is hit, the current value of x is added to the list values.

POSTED BY: Jason Grigsby
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract