Why does UICONTROL fail to create a slider when following the example in the documentation of MATLAB 7.3 (R2006b)?

1 次查看(过去 30 天)
I am trying to create a slider using the UICONTROL command as specified in the example as given in the documentation:
uicontrol('Style','slider','Min',1,'Max',7,'SliderStep',[0.1 0.6])
I receive following warning when I execute the above command:
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.
I would expect that an example in the documentation should render a slider control without any warnings.

采纳的回答

MathWorks Support Team
MATLAB 7.3 (R2006b) defaults to a value of zero for the current value of the slider when it is created, if no default value is set. Since the example tries to create a slider whose current value is lower than the minimum value, MATLAB prevents the creation of the slider, and throws the warning.
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:
uicontrol('Style', 'slider', 'Min',1,'Max',7, 'SliderStep',[0.1 0.6], 'Value',1);

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

产品


版本

R2006b

Community Treasure Hunt

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

Start Hunting!

Translated by