フィルターのクリア

How to Move a Slider- bar when push button presses in GUI?

8 ビュー (過去 30 日間)
sk karimulla
sk karimulla 2020 年 12 月 17 日
コメント済み: sk karimulla 2020 年 12 月 18 日
There are two buttons one is forward and another backward,When forward button presses slider should start moving forward if backward buttons press slider should move backward direction.kindly suggest your ideas to implement this functionality in GUI.

採用された回答

Cris LaPierre
Cris LaPierre 2020 年 12 月 18 日
Guide or app designer?
The slider property 'Value' determines the position of the slider bar. The value must be between the slider limits.
To move the slider when the pushbutton is pressed, the pushbutton callback function needs to change the value property of the slider. Add to the current value to move it forward. Subtract from it to move backward.
In guide, the code for the forward button might include something like this (untested)
sVal = get(handles.slider1,'Value');
set(handles.slider1,'Value',sVal+2);
In app designer, it might include this
app.slider1.Value = app.slider1.Value + 2;
Of course you'll want to include a check that only adjusts the value if the result is within the slider limits. You'll also want to set the amount you change Value to meet your needs.

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by