Limited no. of points in a slider?
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Irina Vermesan
am 2 Okt. 2017
Kommentiert: Irina Vermesan
am 3 Okt. 2017
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
1 Kommentar
Jan
am 2 Okt. 2017
Note: Instead of explaining in words, what you have a settings in your uicontrol command, it is more useful in the forum, if you post the line of code. Then it is easier to reproduce, what you observe.
Akzeptierte Antwort
Jan
am 2 Okt. 2017
Bearbeitet: Jan
am 2 Okt. 2017
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
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!