Set GUI sliders to parameters?
Mostrar comentarios más antiguos
I have a function with three variables :k, mu, and L. I have created a GUI with sliders for these parameters as well as axes to plot the function. Currently, I can plot the function when I preset the values of the parameters in the original function but I am not sure how to link the GUI sliders with the parameters in my original function. I am new to Matlab so simple answers are appreciated!
Respuestas (1)
In the callback for whatever GUI control is activated to perform your calculations, add in code that looks something like this:
k = get(handles.k_slider,'Value');
mu = get(handles.mu_slider,'Value');
L = get(handles.L_slider,'Value');
Since these values will range from 0 to 1, you'll have to scale them to whatever range you want your parameters to be. So if your value for k can vary between 40 and 70, for example, you could add the following after obtaining your slider value:
k = 40 + k * 30
Categorías
Más información sobre Vehicle Dynamics Blockset en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!