I know questions that get at this very issue have been posed in other ways here, but as a relative beginner, I've had trouble understanding the answers.
For my application, I am developing a simple user interface that takes a dynamic variable through InputField[] which then specifies how many dynamic variables are to be generated in a list.
Here is a simple example of the error I encounter:
DynamicModule[{x = 5},
n = Dynamic@Table[Symbol["p" <> ToString@i], {i, 1, x}];
InputField[Dynamic@x]
n[[1]] ]
Above, x is a dynamic variable that specifies how many dynamic variables (of the name p1, p2, p3, etc.) are to be made in an automatically generated list. I then attempt to show the first dynamic variable in that list, and I get some strange output.
When x = 3, Mathematica makes a list of p1, p2, and p3 with their own InputFields and when the value of one is changed, all of the others also change to that value.
Can anyone explain this behavior?
InputField[Dynamic@x]
with the listn[[1]]
. $\endgroup$ – Karsten 7. Jan 26 '15 at 5:15p[1]
,p[2]
, ... instead ofp1
,p2
, then all becomes easy $\endgroup$ – Rojo Jan 26 '15 at 6:05