How to move slider-bar with a step-size of two?
1 回表示 (過去 30 日間)
古いコメントを表示
Hey there everyone. I have a slider which I want to increase like 1:2:10 by dragging the bar with mouse. How can I accomplish that?
Thanks in advance!
1 件のコメント
Rik
2020 年 5 月 18 日
I don't know if you have already come across this page, but especially since GUIDE is going to be removed from Matlab, here are some useful tips: https://www.mathworks.com/matlabcentral/answers/483657-how-to-create-a-gui
採用された回答
Rik
2020 年 5 月 17 日
編集済み: Rik
2020 年 5 月 17 日
Round the Value property to the nearest value in your array in the callback function.
allowed_vals=1:2:10;%better: store this in the guidata struct
val=3.2;%val=get(hObject,'Value');
[~,idx]=min(abs(allowed_vals-val));
val_rounded=allowed_vals(idx);
%set(hObject,'Value',val_rounded);
disp(val_rounded)
4 件のコメント
Rik
2020 年 5 月 18 日
You need to blur the original image, so you will have to store both the original and the processed version.
その他の回答 (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!