Consider this example:

Manipulate[status = Dynamic[If[a < b, Yes, No]], {a, 2}, {b, 5}]

The output of this calculation is


when I call status again I get Yes as expected.

No when I want to used the output of status in further calculation I failed. I tried to do the following:

status === Yes

the results is False

The full form of status is not what is seen in the output.

My question is, how to use the output of expression no matter what the definition of that expression is.

(Note: status[[1]] does not help because the level of the output is unpredictable)

Thank you.

  • 2
    $\begingroup$ Take a look at Setting. Moreover, first argument of Manipulate is effectively wrapped in Dynamic so the one in your code is only making problems with it's head and gives nothing. $\endgroup$
    – Kuba
    Aug 22, 2014 at 4:55

2 Answers 2

(status /. Dynamic -> Identity) === Yes
(* True *)

If you want the value of status outside of the Manipulate to be updated whenever it changes inside the Manipulate, just drop the explicitDynamic`.

 Manipulate[status = If[a < b, Yes, No], {a, 2}, {b, 5}]
 Dynamic[status === Yes]

The Manipulate will still work as it did before the change, and the second expression will track the changed to status made inside the 1st.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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