It looks likely to me that the Max property of the slider is not getting set until after you try to set the Value, so your Value is being interpreted as being outside the default range Min = 0 to Max = 1. Set the Max at the same time you set the Value. If you do not know a minimum value for the Max then you should not be setting the Value before you know that the upper bound will be at least as large as your desired default Value.
To set default value of slider in gui
1 次查看(过去 30 天)
显示 更早的评论
I want to set default value of slider in gui created by guide.I've tried this,
1)In gui_OpeningFcn , is set default value by,
set(handles.slider1,'Value',5); %(min-0 & max-10 in my case)
Slider disappears & it shows an error:
slider control can not have a Value outside of Min/Max range
Control will not be rendered until all of its parameter values are valid
2)Seeing that 1) did not work, I then tried in slider1_CreateFcn
handles.slider1 = gcbo;
set(gcbo,'Value',5);
Even now similar error appears.
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Migrate GUIDE Apps 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!