Why does my slider disappear when I change the Min and Max properties?

조회 수: 6 (최근 30일)
When I create a slider and set the Min property of the slider to 1 and the Max property to 10, my slider disappears. Why does it disappear and how do I get it to reappear?
u = uicontrol('Style', 'slider');
set(u, 'Min', 1, 'Max', 10);

채택된 답변

MathWorks Support Team
MathWorks Support Team 2010년 11월 5일
There are two reasons why the slider can disappear when you change the Min and Max properties.
1) The Value property of the slider is no longer between the Min property and the Max property. If this is the case, change the Min, Max, and Value properties so that the Min property is less than or equal to the Value property, which is less than or equal to the Max property:
u = uicontrol('Style', 'slider');
set(u, 'Min', 1, 'Max', 10, 'Value', 1);
2) The Max property of the slider is less than or equal to the Min property of the slider. To correct this, change the Min property and/or the Max property of the slider so that the Min property is strictly less than the Max property.
  댓글 수: 1
Image Analyst
Image Analyst 2020년 4월 23일
If you want to set the min, max, and value all to the same value, then do this:
u.Min = value;
u.Max = value;
u.Value = value;
If you're using GUIDE, then u should be replaced by handles dot (the tag name of the slider), like handles.sldMySlider.
handles.sldMySlider.Min = value;
handles.sldMySlider.Max = value;
handles.sldMySlider.Value = value;

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

제품


릴리스

R2010b

Community Treasure Hunt

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

Start Hunting!

Translated by