MATLAB: Does UICONTROL fail to create a slider when following the example in the documentation of MATLAB 7.3 (R2006b)

docexampleMATLABslider

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.

Best Answer

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);