Why slider is not working in my GUI?

조회 수: 26 (최근 30일)
Stelios Fanourakis
Stelios Fanourakis 2018년 6월 10일
댓글: Stelios Fanourakis 2018년 6월 17일
I have created a GUI consisted of 4 axes, a push button and a slider. Although, the slider commands (callbacks, uicontrols, guidata etc) including the mouseScroll function, are perfectly working, because they have been tested to a different figure (not my GUI) consisted of a single hFig and an axes1 and it perfectly work, but when I try to implement the same commands to my GUI it fails.
You will notice to the m files I attach, that I have placed the same commands over and over again to almost all the relative callback functions (slider1_Callback, mouseScroll, loadButton, etc) because they were asking for the variables to be stated.
Any help on this?
  댓글 수: 1
Stelios Fanourakis
Stelios Fanourakis 2018년 6월 10일
The slider is not working. It won't move either under wheel scrolling or arrowheads pressing. If it slightly moves, it goes back to the beggining instantly and it won't control the image depicted on the first axes1, it won't alter.

댓글을 달려면 로그인하십시오.

채택된 답변

Jan
Jan 2018년 6월 11일
You are creating a new slider inside the callback of the slider:
handles.SliderFrame = uicontrol('Style','slider','Position',[60 20 400 50], ...
'Min',1,'Max',NumFrames,'Value',1, ...
'SliderStep',[1/NumFrames 2/NumFrames], ...
'Callback',@slider1_Callback);
This hides the formerly existing sliders and sets the slider value to 1 for each call.
Importing the list of files in all slider callbacks is a waste of time in addition.
Solution: Create the slider once only, either in GUIDE or in the OutputFcn (where it is done now already also). Then omit the re-creation by uicontrol.
I suggest to call the slider1_callback from the mouseScroll function.
  댓글 수: 27
Stelios Fanourakis
Stelios Fanourakis 2018년 6월 17일
@Jan. You do helping me a lot with your suggestions. It seems I need to keep on forward myself from now and on. One slider I added on the GUIDE and one slider from uicontrol. When the figure is loading, it shows 2 sliders but only one of them actually works.
Now the bottom slider works but it works to infinity. I want the total range of the slider to be the number of image frames, e.g. 15
Stelios Fanourakis
Stelios Fanourakis 2018년 6월 17일
Debugger will only tell me the error point. It won't solve it.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by