0
$\begingroup$

I want to have a dynamic number of manipulators.

             n = 4; c = 4;
             With[{  
                    B_controls = Sequence @@ 
                          Table[ {{ B[i, j], 0}, 0, 1, 0.1}, {i, 1, n}, {j, 1, c} ]
             },

             Manipulate[

Whatever I want to do, and then:

                    Control @ B_controls
                    ]

But I get the following error:

Manipulate::vsform: Manipulate argument {{{B[1,1],1},0,1,0.1},{{B[2,1],1},0,1,0.1}} does not have the correct form for a variable specification.

Manipulate::vsform: Manipulate argument {{{B[1,2],1},0,1,0.1},{{B[2,2],1},0,1,0.1}} does not have the correct form for a variable specification.

It seems like I'd have to do a simple array of controls, but I'd like to know if I can do it in this way (or if there's a better way).

Thanks!

$\endgroup$
4
  • $\begingroup$ Got it. Thanks! $\endgroup$ Mar 10, 2017 at 19:50
  • $\begingroup$ What does the title—"two dimensional manipulators"—have to do with this question? $\endgroup$ Mar 10, 2017 at 20:10
  • $\begingroup$ I meant it in the sense that the manipulators are a two dimensional matrix. $\endgroup$ Mar 10, 2017 at 20:14
  • $\begingroup$ First of all, "two-dimensional manipulators" refers to SLIDER2D. I think your title should be "Manipulating the number of controls" or something like that. Clearer. Easier for people to find later. $\endgroup$ Mar 10, 2017 at 21:15

1 Answer 1

1
$\begingroup$

enter image description here

n = 4; c = 4;
With[{t = Table[b[i, j], {i, 1, n}, {j, 1, c}],
  f=Table[{{b[i,j],0},0,1,0.1,ImageSize->Tiny},{i,1,n},{j,1,c}], 
  bControls = 
   Sequence @@ 
    Flatten[ Table[{{b[i, j], 0}, 0, 1, 0.1}, {i, 1, n}, {j, 1, c}],1]},

 Manipulate[MatrixForm@t,bControls,TrackedSymbols :> {t}]
 ]
$\endgroup$
2
  • $\begingroup$ Nasser how did you save the gif with the arrow pointer? $\endgroup$
    – Alucard
    Mar 10, 2017 at 22:46
  • $\begingroup$ @Alucard I use program called LICEcap to capture screen to animated gif $\endgroup$
    – Nasser
    Mar 10, 2017 at 23:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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