Set GUI sliders to parameters?

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!

답변 (1개)

Evan
Evan 2013년 7월 15일
편집: Evan 2013년 7월 15일

0 개 추천

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

카테고리

도움말 센터File Exchange에서 Vehicle Dynamics Blockset에 대해 자세히 알아보기

태그

질문:

2013년 7월 15일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by