Trying to get the values of sliders from a module

I generated n number of sliders using the idea from Manipulate with a variable number of sliders

But I need the updated values of these sliders to use to evaluate a function . I tried couple of things but I could not figure is out. I can get the values but even if I have 4 values , the dimension of the data is 1.How can I get these values?

Preplot[lims_, midpoints_, limsL_, limsR_, limsteps_] := Module[{} ,
data = midpoints;
controls = 
DynamicModule[{n = Length[midpoints]}, 
      With[{i = i}, {lims[[i]], 
        Slider[Dynamic[data[[i]]], {limsL[[i]], limsR[[i]], 
          limsteps[[i]]}], Dynamic[data[[i]]]}], {i, n}]]],
   Dynamic[data[[i]]];}, Center]];
 Return[{controls, Dynamic[data]}]];

 lims = {x, z, y, p};
 midpoints = {0.5, 3, 4.5, 7};
 limsL = {0, 2, 3, 4};
 limsR = {1, 4, 6, 10};
 limsteps = (limsL - limsR)/25;
 sliders = Preplot[lims, midpoints, limsL, limsR, limsteps][[1]]
 values = Preplot[lims, midpoints, limsL, limsR, limsteps][[2]]

The output looks like

pgtYl Trying to get the values of sliders from a module

Let’s block ads! (Why?)

Recent Questions – Mathematica Stack Exchange