I'm trying to code to generate 'dynamic' controllers and to set initial values (initStart and initEnd):

n = 5;
Manipulate @@ Join[
  {Grid[{Join[{"i"}, Range[n]], {"start[i]", start[1], start[2], 
      start[3], start[4], start[5]}, {"end[i]", end[1], end[2], 
      end[3], end[4], end[5]}}, Frame -> All]},
  {{{initStart, Dynamic[{1, 2, 3, 4, 5}]}}},
  {{{initEnd, Dynamic[{10, 12, 13, 14, 15}]}}},
      {{start[#], Dynamic[initStart[[1, #]]]}, 1, 10, 1},
      {{end[#], Dynamic[initEnd[[1, #]]]}, 1, 10, 1}
      } & /@ Range[n], 1]

I still do not fully understand why referred variables behave as if they had an additional dimension: e.g., initStart and initEnd are supposed to be one-dimensional (vectors or flat lists), but to refer to them, I needed to handle them as two-dimensional (like initStart[[1,#]]).

Can anyone explain the reason for that?


Your Answer

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

Browse other questions tagged or ask your own question.