I'm trying to use the output value of a manipulate to define a variable that will be used for a calculation. I've created a minimal example of what I'm trying to do. In this case, I'd like to use the output value of test to define the variable testVar so that I can use testVar in defining testCal.
Manipulate[
testVar = If[test == "b", 2 , 5];
testCalc = testVar*2;
Text[testCalc],
{{test, "a", "Test Manipulate"}, {Style["a", 14, Red],
Style["b", 14, Blue], Style["c", 14, Green]}}
]
When I run this code, I get the correct output, which seems promising.
Unfortunately, when I click on any of the options, testCalc doesn't properly evaluate. I've tried using Dynamic in a few places, but haven't been able to figure out how to get testCalc to properly evaluate when I click on the different options for Test Manipulate.