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 件のコメント
採用された回答
Walter Roberson
2012 年 7 月 5 日
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.
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!