Filter löschen
Filter löschen

Set default value for slider in MATLAB

2 Ansichten (letzte 30 Tage)
Nick am 24 Okt. 2012
I'm trying to set a default value for my slider, but for some reason the handle value is not equal to that of the slider. I tried setting it in the CreateFcn function and then calling it back in my main function, but for some reason it's not being saved in handles.
handles.fuel_slider1 = get(gcbo,'Value')*100
neither assigning nor guidata will retain the handles value and I can't call it anywhere.
I basically need to set 6 sliders to 100% and have those values be available in handles. Currently it returns the actual handle 'code' value or whatever it's called (fuel_slider2: 720.0043)
Any ideas?

Antworten (1)

Sean de Wolski
Sean de Wolski am 24 Okt. 2012
This is why I avoid using gcbo. Explicitly set the handles.sliderx value.
And I recommend against using assignin. Instead use a breakpoint to debug this inside of the GUI if necessary.


Mehr zu Interactive Control and Callbacks finden Sie in Help Center und File Exchange


Community Treasure Hunt

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

Start Hunting!

Translated by