Effacer les filtres
Effacer les filtres

Slider is still at min and not moving

1 vue (au cours des 30 derniers jours)
Jakub
Jakub le 6 Avr 2013
Commenté : Image Analyst le 10 Déc 2014
Hi, this is part of my super simple slider, but it still not working...Slider is not moving. Thanks for help!!
function slider1_Callback(hObject, eventdata, handles)
sliderMin = 1;
sliderMax = 520; % this is variable
sliderStep = [1, 1] / (sliderMax - sliderMin) % major and minor steps of 1
set(handles.slider1, 'Min', sliderMin);
set(handles.slider1, 'Max', sliderMax);
set(handles.slider1, 'SliderStep', sliderStep);
set(handles.slider1, 'Value', sliderMin); % set to beginning of sequence
time=get(handles.slider1,'Value');
set(handles.text1,'String',num2str(round(time)))
guidata(hObject, handles);
  1 commentaire
Walter Roberson
Walter Roberson le 7 Avr 2013
It isn't moving from what to what?
Note that you might need to add a drawnow() to give a chance for the GUI to update.

Connectez-vous pour commenter.

Réponse acceptée

Image Analyst
Image Analyst le 7 Avr 2013
Yeah, because you're setting the value equal to the min every time the user tried to slide it. Remove this line to fix it:
set(handles.slider1, 'Value', sliderMin); % set to beginning of sequence
  2 commentaires
Tuyen
Tuyen le 10 Déc 2014
I have the same issue. My min is 1986 and max is 2011. When I remove that line, the slider bar also disappears and warnings pop up...
Image Analyst
Image Analyst le 10 Déc 2014
What are the "step" sizes?

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Graphics Objects dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by