MATLAB: Slider component, unity steps

slider

I have a sldier component that I want to increment in unity steps. The minimum needs to be 1 and the max is a variable but will be between 10 and 30.
I can't understand the set properties of the slider component, it appears min and max work but min must be 0, it can't be 1. But then the step size seems to be in fractions??

Best Answer

min and max can both be anything numeric provided min is less than max. I would advise setting both in the same statement (and 'value' too) otherwise you can run into problems if you set the min first and it is above or equal to the current max or value property of the slider.
step size is in normalised units based on the range max - min of your slider.
figure; uicontrol( 'Style', 'slider', 'Min', 1, 'Max', 10, 'Value', 1 );
works, for example. Setting slider step is a little more complicated though. I wrote a custom class that handles that so it is a while since I have had to do it manually to get nicely rounded increments.