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

22 vues (au cours des 30 derniers jours)
ali hadjer
ali hadjer le 12 Nov 2015
Modifié(e) : Image Analyst le 13 Nov 2015
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????

Réponse acceptée

Image Analyst
Image Analyst le 12 Nov 2015
Modifié(e) : Image Analyst le 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.

Plus de réponses (0)

Catégories

En savoir plus sur Specifying Target for Graphics Output dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by