Re: variable number of controls in manipulate
- To: mathgroup at smc.vnet.net
- Subject: [mg105576] Re: variable number of controls in manipulate
- From: dh <dh at metrohm.com>
- Date: Wed, 9 Dec 2009 05:51:52 -0500 (EST)
- References: <hffjje$6s2$1@smc.vnet.net>
Hi Greg,
Evaluate is only activated if it is the argument of a function with one
of the Hold attributes, like e.g. Manipulate[ Evaluate[..],..]. However,
if you say: Manipulate[k= Evaluate[..],..], then Evaluate is an
argument of Set, not of Manipulate and has no effect.
therefore:
Manipulate[Evaluate@(k = Total[...
Daniel
Greg Colbourn wrote:
> Hi.
>
> I'm running ensembles of models and want to look at the results in
> Mathematica in an automated way. Part of this revolves around
> automatically generating lists of buttons corresponding to variables
> using Manipulate - the number of variables to loop over is itself
> variable(!).
>
> I can work out automatically a number corresponding to an individual
> ensemble member depending on which variables are chosen:
>
> (* edit these to contain more or less variables, with more or less
> values for \
> each variable: *)
> vartitles = {"emissions", "Weathering scheme", "Ca weath feedbcak",
> "Si weath feedback"};
> varvalues = {{"none", "1000GtC", "3000GtC", "5000GtC"}, {"Globavg",
> "GKWM",
> "GEM_CO2"}, {"on", "off"}, {"on", "off"}};
>
> nvars = Table[Length[varvalues[[i]]], {i, Length[varvalues]}];
> nvar = Length[nvars];
>
> Format[v[n_Integer]] := "v" <> ToString[n];
> list = Array[v, nvar];
> varmultipliers =
> Append[Reverse[
> Table[Product[nvars[[n]], {n, nvar, nvar - m, -1}], {m, 0, nvar -
> 2}]], 1];
>
> (* this generates ensemble number corresponding to variable selection:
> *)
> Manipulate[
> (*k=*)Evaluate[
> Total[(Evaluate[Table[Evaluate[list][[i]], {i, nvar}]] - 1)*
> varmultipliers] + 1],
> ##] &@(Sequence @@
> Table[{{list[[i]], 1, vartitles[[i]]},
> Table[j -> varvalues[[i, j]], {j, nvars[[i]]}]}, {i, nvar}])
>
> However, when I want to do anything with this number (removing the
> commented out "k="), it becomes a list of symbols and no longer a
> number, despite me using Evaluate. Ideally, I want to be able to use
> this number (k) as an index to pick out data from arrays.
>
> What do I need to do?
>
> Greg Colbourn
>
>