1
$\begingroup$

Given a list of lists:

list = {{x1, x2, x3}, {y1, y2, y3}, {z1, z2, z3}};

Some self-explanatory lists which I like to create using Manipulate[]:

(*picking the 1st elements from `x` abd `y` tuples and all elements of `z`*)
M11a = {
         {x1, y1, z1},
         {x1, y1, z2},
         {x1, y1, z3}
       }; 

(*picking the 1st and 2nd elements from `x` and `z` tuples and all elements of `y`*)
M1a2 = {
         {x1, y1, z2},
         {x1, y2, z2}, 
         {x1, y3, z2}
        };

(*picking the 3rd and 2nd elements from `x` and `z` tuples and all elements of `y`*)
M3a2 = {
         {x3, y1, z2},
         {x3, y2, z2},
         {x3, y3, z2}
        };

I like to create Manipulate[] to automatically generate the above matrices with three controls. For example, when the values of 1st and 3rd controls (x and z, respectively) are fixed, the other control for y should take all the values in {y1, y2, y3}.

$\endgroup$
1
$\begingroup$
Manipulate[MatrixForm @
 Tuples[Range[3] /. i_Integer :> If[MemberQ[fixed, i], {xl, yl, zl}[[{i}]], list[[i]]]],
 {{fixed, {1, 3}}, Range@3, TogglerBar}, 
 {xl, list[[1]], Slider, Appearance -> "Labeled", Enabled -> MemberQ[fixed, 1]},
 {yl, list[[2]], Slider, Appearance -> "Labeled", Enabled -> MemberQ[fixed, 2]},
 {zl, list[[3]], Slider, Appearance -> "Labeled", Enabled -> MemberQ[fixed, 3]}]

enter image description here

enter image description here

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.