Adjusting slider to scroll trough each image in 3D stack in GUI

11 ビュー (過去 30 日間)
Mario
Mario 2017 年 8 月 10 日
編集済み: Stephen23 2017 年 12 月 21 日
Hi,
I am writing a small GUI (it is in the attachment) and I am having trouble adjusting the slider to work so that when I use the slider I will be able to scroll trough each image in a 3D stack.
Currently I am getting an error:
Warning: slider control can not have a Value outside of Min/Max range
and I am not sure how to solve it.
I am also trying to display the number of the current slice in this small GUI.
Any help would be appreciated.
Thanks!

採用された回答

Stephen23
Stephen23 2017 年 8 月 10 日
編集済み: Stephen23 2017 年 12 月 21 日
Change the order in which you specify the parameters:
set(handles.hslider, 'Value', 1, 'Min', 1, 'Max', numel(filenames), ...
'SliderStep', [1,1]./(numel(filenames) - 1))
Otherwise you have a conflict because you change the Min value and this puts the default Value outside the min-max range (the input arguments are processed from left to right).
Addendum: to update a value continuously as a slider is moved see this answer:
  20 件のコメント
Mario
Mario 2017 年 8 月 11 日
編集済み: Mario 2017 年 8 月 11 日
I finally found a solution to this problem.
this link helped me a lot!
So for anyone strugling with this, I advise to check the above link.
Thank you all for your help!
EDIT Yes, true. But I managed, by using this link above, write a code in GUIDE and make it work.
Shankhabrata Nag
Shankhabrata Nag 2017 年 10 月 24 日
Hi Mario,
Can you upload the final code you've written?
Cheers

サインインしてコメントする。

その他の回答 (1 件)

Arjun Chawla
Arjun Chawla 2017 年 12 月 20 日
Hi Mario, can you please upload your final gui code, that would be greatly appreciated. Thanks!

Community Treasure Hunt

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

Start Hunting!

Translated by