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 ExchangeVehicle 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