How can I use a list of variable names within Symbol[]
inside a Manipulate[]
, specifically using Control[]
?
I assume the problem arises due to the HoldAll
attribute of Manipulate
, similar to here, but I fail to find the right solution.
The following Mathematica code illustrates the problem:
myVariables={"var1","var2"}
Map[Symbol[#]&,myVariables]
Manipulate[Map[Symbol[#]&,myVariables],Grid[{{Control[{var1,0,1}],Control[{var2,0,1}]}}]]
Map[Control[{Symbol[#],0,1}]&,myVariables]
Manipulate[Map[Symbol[#]&,myVariables],Grid[{Map[Control[{Symbol[#],0,1}]&, myVariables]}]]
Symbol
? It is designed to convert strings to symbols. Also, take a look at this, something similar should work for you $\endgroup$