MATLAB: Limited no. of points in a slider

slider gui

Hi All,
I have a slider with these settings: Min = 0, Max = 51000, SliderStep = 0.05 and Value = 51000.
When I press the left arrow, the slider position jumps directly to 50000 (instead of 50999.95). From my tests, it seams that if there are more than 1000000 (Max/SliderStep) points in the slider, the slider does not accurately work.
My questions: is there really a limitation of the no. of the points in the slidebar? Has anyone encounter this issue? If yes, have you found a workaround?
Thank you, Irina

Best Answer

Why do you assume to get the value of 50999.95 when you press the arrow? The steps are the fractions of the available range, not the absolute step width. 0.05 means 5% and I cannot reproduce your observation:
uicontrol('Style', 'Slider', ...
'Min', 0, 'Max', 51000, 'Value', 51000, ...
'SliderStep', [0.05, 0.05], ...
'Callback', @(h,e) disp(get(h, 'Value')))
When I click on the left arrow, I get 48450, which is 51000 - 0.05 * (51000 - 0), as expected, and not 50000. I need 1/51 as SliderStep to obtain a step width of 1000.
For the limitation of the no. of the points, the documentation explains clearly:
Both minorstep and majorstep must be greater than 1e-6, and minorstep
must be less than or equal to majorstep
or
doc uicontrol % -> uicontrol properties -> Slider Step