Timeline for Trying to get the values of sliders from a module
Current License: CC BY-SA 3.0
19 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jun 16, 2020 at 9:23 | history | edited | CommunityBot |
Commonmark migration
|
|
May 23, 2017 at 12:35 | history | edited | CommunityBot |
replaced http://stackoverflow.com/ with https://stackoverflow.com/
|
|
Apr 13, 2017 at 12:56 | history | edited | CommunityBot |
replaced http://mathematica.stackexchange.com/ with https://mathematica.stackexchange.com/
|
|
Jul 29, 2016 at 12:11 | history | edited | Kuba | CC BY-SA 3.0 |
added 1513 characters in body
|
Jul 29, 2016 at 11:39 | comment | added | Erdem | @ Kuba either I am really missing your point in here or I am not clear enough. but I updated my question where I explain in detail. I think I explicitly need the values of the sliders so I can assign them to a variable in the function. | |
Jul 29, 2016 at 8:06 | comment | added | Kuba |
@Erdem take the code from this answer and replace the very last line with Graphics[Point@Dynamic@Thread[{data, 1}]] . It uses data to plot. So it is the same thing you need, what else do you need?
|
|
Jul 29, 2016 at 8:03 | comment | added | Kuba | @Erdem I've made a mistake in the last sentence, I meant "Dunamic is not supposed to be a part of a procedure but a GUI element". | |
Jul 29, 2016 at 8:01 | comment | added | Erdem |
@Kuba I am trying to make the code Plot 2D planes of n dimensional function. User will choose 2 dimension variable outside lims,` lims={x,z,y,p};` and assume u is u=x z y p w u in this case user choose w u plane. That means I will need to evaluate u with the slider values and do Plot3D =[uevaluated, {w,lw,rw},{u,lu,ru}] . I need to do that like it is done link second example. Inside the preplot module actually. I was thinking getting the data and plotting it but that does not make sense.
|
|
Jul 29, 2016 at 5:36 | comment | added | Kuba |
@Erdem If you modify data with e.g. Sliders , You don't need Dynamic to access it. If you evaluate data in a notebook you will see that each time it will have values up to date with sliders. The question is, "when" do you want to perform your procedure and what do you want to do with u . If you want u to be always up to date you can use something like DynamicWrapper or the second argument of dynamic to do so. Or just use Dynamic[u = u/. ... ; PlotWithUOrWhatever] , the point is, Dynamic is supposed to be a part of a procedure, not the interface.
|
|
Jul 28, 2016 at 18:15 | comment | added | Erdem |
I am reading (going repeating what they did there) that link and I think I understand what Dynamic does. In this approach I have no access to the data other than displaying it. From the link you provided I reached link which almost the same problem that I have. I might be missing but both the links just explains why the there is a problem but not a way around it. ps: I realized that u=u/.->lims[[1]]->Dynamic@data[[1]] this was not a valid syntax :).
|
|
Jul 28, 2016 at 6:34 | history | edited | Kuba | CC BY-SA 3.0 |
added 441 characters in body
|
Jul 28, 2016 at 6:26 | comment | added | Kuba |
@Erdem Please take a look at the second comment here and follow the link. And questions linked there. Undestanding what Dynamic is for is essential. You can also take a look at Introduction to Dynamic tutorial.
|
|
Jul 28, 2016 at 6:25 | comment | added | Kuba |
@Erdem please focus u=u/.->lims[[1]]->Dynamic@data[[1]] this is an invalid syntax with those two -> . Moreover it does not what you think it does. u will have Dynamic inside, it is not a value, it is a specially handled place in a notebook but you can't use it as an ordinary variable. But you can use data and wrap Dynamic over the whole GUI element that you want to display. Dynamic[value] only makes sense when it is meant to display just Dynamic[value] (or for the FrontEnd in some cases, not relevant here).
|
|
Jul 27, 2016 at 14:45 | comment | added | Erdem |
first, thank you for taking your time and helping. The idea of using the dynamic is to able to obtain current values of the sliders. Without dynamic the current values will be the initialData all the time. I even tired to insert the Plot3D in the preplot module. That way I would not need to get the data out. What troubles me why u=u/.->lims[[1]]->Dynamic@data[[1]] is working but I can't do that inside a loop. Assume u = x z y p w o, & lims[[1]]=x, so this takes the x value and evaluates the u function. @Kuba
|
|
Jul 27, 2016 at 14:20 | comment | added | Kuba |
@Erdem using my approach you can just use Dynamic@whateverFunction@data instead of whateverFunction@Dynamic@Data . With yours, you have to strip the Dynamic , you are returning, with Setting . Why whateverFunction will usualy not work on Dynamic[data] is explained in the answer linked in my previous comment.
|
|
Jul 27, 2016 at 14:15 | comment | added | Erdem |
I think I have the problem Michael is pointing out. I am reading to understand of I can use the values from Dynamic@data. I can get the values from the sliders Dynamic@data[[1]] first one. However, if I want to do it in a loop to evaluate the function as Do[u=u/.->lims[[i]]->Dynamic@data[[i]];,{i,n}] . The i is creating a problem for me. @Kuba @Micheal E2
|
|
Jul 27, 2016 at 13:35 | comment | added | Michael E2 |
It might be worth pointing out to the OP and others struggling to understand Dynamic[data] vs. data , that data itself contains the values to be used "to evaluate a function," not Dynamic[data] .
|
|
Jul 27, 2016 at 10:55 | history | edited | Kuba | CC BY-SA 3.0 |
added 2 characters in body
|
Jul 27, 2016 at 10:46 | history | answered | Kuba | CC BY-SA 3.0 |