Set slider Max and Min value

20 ビュー (過去 30 日間)
Cheng Yoong
Cheng Yoong 2011 年 11 月 14 日
コメント済み: Alison Nguyen 2018 年 7 月 18 日
I tried to set the Min value of slider to 1 and Max value to 2. But after I execute it,the slider doesn't appear in GUI and matlab return an error: Warning: slider control can not have a Value outside of Min/Max range Control will not be rendered until all of its parameter values are valid
Anyone know how to solve this problem?

採用された回答

Walter Roberson
Walter Roberson 2011 年 11 月 14 日
What 'Value' are you initializing the slider to? The default is 0 for a slider no matter what the Min and Max are.
  3 件のコメント
Walter Roberson
Walter Roberson 2011 年 11 月 15 日
Yes, no problem, You just have to ensure that you initialize the Value parameter so that it is in that range.
uicontrol('Style','slider','Min',1,'Max',2,'Value',1)
Cheng Yoong
Cheng Yoong 2011 年 11 月 16 日
Thanks a lot. What does 'Value' mean?
If i want the Min to be 2, I have to change 'Value' to 2 as well?

サインインしてコメントする。

その他の回答 (2 件)

Naseeb Gill
Naseeb Gill 2018 年 5 月 10 日
Although the correct answer is already given by Walter Roberson, I want to add something more.
I also faced the same problem and solved it using Property Inspector of Slider.
For example, my lower limit was 0.2 and the upper limit was 0.5. So, in Property Inspector of Slider, a row with name Value is there (2nd last). By default, its value is always zero but my minimum value was 0.2 so it was showing the error. To avoid error I put Value = 0.35. As shown in Fig.
Remember your value in Value row should be equal to or more than your minimum value.
  1 件のコメント
Alison Nguyen
Alison Nguyen 2018 年 7 月 18 日
Thank You!!! this helped so much

サインインしてコメントする。


ns
ns 2013 年 1 月 11 日
To create sliders using the UICONTROL function, specify the value of the slider at its time of creation to be greater than or equal to the 'Min' value. The following example code will work as expected:

カテゴリ

Help Center および File ExchangeEnvironment and Settings についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by