i need help for this, setting slider steps!!!!!​!!!!!!!!!!​!!!!!!!!!!​!!!!

22 views (last 30 days)
Hello
I want to increment the value of my slider by one like [1:1:80]. For example :
1 2 3 4 5 6 7 8.......... until the value 80
how can I do this ?????
Can I do this with the Property Inspector????

Accepted Answer

Image Analyst
Image Analyst on 12 Nov 2015
Edited: Image Analyst on 13 Nov 2015
In code (your m-file) you can get the min and max and make the step one over the range:
maxSliderValue = get(handles.slider1, 'Max');
minSliderValue = get(handles.slider1, 'Min');
theRange = maxSliderValue - minSliderValue;
steps = [1/theRange, 10/theRange];
set(handles.slider1, 'SliderStep', steps);
Put this in your GUI's OpeningFcn function or whenever you change the slider's max value (which you probably don't do in your program.)
If you do it in the Property Inspector and have 1 as the min and 80 as the max, you should set the small step to 1/79 = 0.012658227848101, and the large step as some multiple of that, like 2 or 3 times as large.

More Answers (0)

Categories

Find more on Specifying Target for Graphics Output in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!