Slider warnings and errors!!!

3 views (last 30 days)
Jean
Jean on 21 Jul 2011
Hello to all,
I am using some sliders in my GUI and after I enter the values in my "Values" section in property editor Matlab sys that
Warning: slider control requires a scalar value.
I entered , the following set of numbers:
500000
1000000
2000000
5000000
10000000
and it still was not satisfied!
What kind of variables does it like?
Best regards,
Jean

Answers (2)

Fangjun Jiang
Fangjun Jiang on 21 Jul 2011
You can only specify one number, e.g. 50000.
For this problem, I think the program GUIDE needs to be improved. A slider is for the user to input a value between the Min and Max. So the property editor allows the user to specify the Min value and the Max value. The "Value" property specify the initial position of the slider. Why does the property editor under GUIDE for slider allow the user to input multiple values?

Paulo Silva
Paulo Silva on 21 Jul 2011
Fangjun Jiang is right, you are trying something similar to this:
s=uicontrol('style','slider')
set(s,'value',[1 2])
instead of
s=uicontrol('style','slider')
set(s,'value',1)
%inspect(s) %opens the property inspector
For the slider the property inspector has the Value line that accepts several values but you can only have one there because each slider can only have one value selected.
If you want the slider to jump only to certain values when the user moves it you must change the SliderStep property and probably Min and Max also.

Categories

Find more on Scope Variables and Generate Names 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!