Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am looking for a command that will output a list of values that correspond to the current parameter values manually set on a particular Manipulate interface.

For example, lets say I create an interactive interface using this code:

 A*Sin[f*t + p],
 {t, 0, 2 Pi},
 PlotRange -> {{0, 2 Pi}, {-1, 1}}],
 {A, 0, 1}, {f, 1, 10}, {p, 0, 2 Pi}]

Then suppose I use the Manipulate interface to set the parameters to some values I like as in the instance shown in the this screen cap:

enter image description here

What I would like to do now is input some command that will output these parameter values that the interface is currently set to (in this case, A = .5, f = 6, p = 1.4).

Ideally, I would like a List in a new cell of the form

{0.5, 6, 1.4}

Perhaps some kind of Dynamic automatic updating feature would be nice too.

This will allow me to continue being lazy and not have to enter these values individually when I refer to them in later code. Thanks to anyone who helps!

share|improve this question
up vote 8 down vote accepted

Perhaps the simplest way is to introduce a global variable storing the Manipulate variables:

 global = {A, f, p};
 Plot[A*Sin[f*t + p], {t, 0, 2 Pi}, 
  PlotRange -> {{0, 2 Pi}, {-1, 1}}],
 {A, 0, 1}, {f, 1, 10}, {p, 0, 2 Pi}]

From now on, we can query global in a different cell any time. If wrapped into Dynamic, it will be updated as the Manipulate is manipulated.

share|improve this answer
sometimes it is possible to overcomplicate the problem but this is certainly the most straight forward approach. – Mike Honeychurch Oct 28 '12 at 8:56
This is exactly what I had in mind. Very simple indeed! Thank you – Sum it Oct 28 '12 at 22:32

If you just want A, f, and p dynamically displayed all the time and printed when desired then:

       TextCell[Grid[{{"A =", A}, {"f =", f}, {"p =", p}}], "Text", 
        ShowStringCharacters -> False]]], {A, f, p}}],
   Plot[A*Sin[f*t + p], {t, 0, 2 Pi},
    PlotRange -> {{0, 2 Pi}, {-1, 1}}]
 {A, 0, 1},
 {f, 1, 10},
 {p, 0, 2 Pi}]

Because the values within the Manipulate are localized it is unclear what you mean by referring to them (the values) in later code.

One thing to do, if your application is to save these values for later use, would be to bookmark the settings which you can do once you click the little icon in the top right hand corner:

enter image description here

From there give the bookmark a name:

enter image description here

I called it "my settings", so now you can revert to these settings from any state simply by selecting "my settings".

enter image description here

You can paste the bookmarked settings if you want to use the values in other code. Another thing could be to paste a snapshot:

enter image description here

share|improve this answer
These methods definitely accomplish my objective and also offer a greater utility than I originally intended. Until now I was unaware of this "Bookmarks" feature that was always just a click away. Thank you for relieving me of my ignorance! – Sum it Oct 28 '12 at 22:36
+1 for the explanation of bookmarks. I ignored them so far! – István Zachar Oct 29 '12 at 10:29

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.