Re: Manipulate and Initialization
- To: mathgroup at smc.vnet.net
- Subject: [mg130311] Re: Manipulate and Initialization
- From: debguy <johnandsara2 at cox.net>
- Date: Tue, 2 Apr 2013 03:27:48 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- Delivered-to: l-mathgroup@wolfram.com
- Delivered-to: mathgroup-newout@smc.vnet.net
- Delivered-to: mathgroup-newsend@smc.vnet.net
- References: <20130323072431.19F0E6A0D@smc.vnet.net> <kimcog$pr5$1@smc.vnet.net>
I think this is more what you asked. Clear[nn]; Manipulate[n, {n,1,nn,1}, Initialization:>(nn=RandomInteger[{5,15}];Print[nn])] "This works fine. The slider can be used in the range from 1 to the printed value." Ok. Isolate the name of nn. nn=23; Module[{nn}, Manipulate[n, {n,1,nn,1}, Initialization:>(nn=RandomInteger[{5,15}];Print[nn])] ] or use a different name than Global`nn which i think is clashing Manipulate[n, {n,1,a`nn,1}, Initialization:>(a`nn=RandomInteger[{5,15}];Print[a`nn])] (btw module actually uses $123nn as the name, and using Global`nn would be 23) Dynamic likely works because (xxx) but you may not want dynamic update it might be too slow for your application. So you might need the above.