フィルターのクリア

GUI - Slider depend another Slider

1 回表示 (過去 30 日間)
Ricardo Gutierrez
Ricardo Gutierrez 2017 年 1 月 26 日
回答済み: Jan 2017 年 1 月 26 日
I want the current value of the first slider to be the maximum limit of the second slider.
How can I do that?

回答 (1 件)

Jan
Jan 2017 年 1 月 26 日
function GUI
H.Fig = figure;
H.Slider1 = uicontrol('Style', 'slider', 'Min', 0, 'Max', 10, ...
'Position', [10, 10, 200, 30], ...
'Callback', @mySlider1CB);
H.Slider2 = uicontrol('Style', 'slider', 'Min', 0, 'Max', 10, ...
'Position', [10, 50, 200, 30], ...
'Callback', @mySlider2CB);
guidata(H.Fig, H);
end
function mySlider1CB(Slider1H, EventData)
H = guidata(Slider1H);
Value = get(Slider1H, 'Value');
set(H.Slider2, 'max', Value);
end
function mySlider2CB(Slider2H, EventData)
Value = get(Slider2H, 'Value');
disp(Value)
end

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by