I have 168 MRI images to scroll. But my slider goes 1,3,5,6,8,10...almost every second image is shown. I've count them and turn out to be that slider has a exactly hundred steps. How can I increase that steps that slider shows one by one image?
Thanks.

2 Kommentare

Stephen23
Stephen23 am 24 Feb. 2019
Bearbeitet: Stephen23 am 24 Feb. 2019
Note that the accepted answer is incorrect. The actual required limits are:
[1/(maxNumberOfImages-1) , 10/(maxNumberOfImages-1)]
^ ^^^ ^ ^^^ missing in the answer
The general solution is actually:
stepSize/(maxLimit-minLimit)
which should make the mistake in the accepted answer clear. See also:
Image Analyst
Image Analyst am 24 Feb. 2019
Good catch Stephen. I've made the change in case someone sees only my answer below and not your correction. Thanks!

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

Image Analyst
Image Analyst am 5 Nov. 2012
Bearbeitet: Image Analyst am 24 Feb. 2019

5 Stimmen

To setup:
maxNumberOfImages = 168;
set(handleToSlider, 'Min', 1);
set(handleToSlider, 'Max', maxNumberOfImages);
set(handleToSlider, 'Value', 1);
set(handleToSlider, 'SliderStep', [1/(maxNumberOfImages-1) , 10/(maxNumberOfImages-1) ]);
To use and find out which value the user is on:
imageNumberSelected = int32(get(handleToSlider, 'Value'));

3 Kommentare

Tomislav
Tomislav am 5 Nov. 2012
Works! I didnt have the last line:
set(handleToSlider, 'SliderStep', [1/maxNumberOfImages , 10/maxNumberOfImages ]);
If you have time can you explain why is 1/max and 10/max.
Thank you very much.
Md. Ashfaque
Md. Ashfaque am 1 Okt. 2013
The two values for the SliderStep property specify how much the slider moves when you hold and scroll it and how much it moves you click the arrows at the side.
Anton Butenko
Anton Butenko am 9 Mär. 2016
exactly the answer i was looking for!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Andy
Andy am 17 Nov. 2017

1 Stimme

this ('SliderStep' property) doesn't exist in slider object of the gui designer.

1 Kommentar

Image Analyst
Image Analyst am 17 Nov. 2017
I find that hard to believe. Attach a screenshot of the property inspector with your slider properties showing.

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

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

Start Hunting!

Translated by