Slider warnings and errors!!!

3 次查看(过去 30 天)
Jean
Jean 2011-7-21
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

回答(2 个)

Fangjun Jiang
Fangjun Jiang 2011-7-21
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 2011-7-21
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.

类别

Help CenterFile Exchange 中查找有关 Scope Variables and Generate Names 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by