2
votes

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.

 set(gcbo,'Value',1)
 handles.fuel_slider1 = get(gcbo,'Value')*100
 assignin('base','handles',handles);
 guidata(hObject,handles);

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 idea?

1

1 Answers

0
votes

Don't use gcbo. If you are developing your UI in GUIDE, you have access to all of the sliders through the handles struct. You have an access to the current slider/uicontrol as well.

For example:

    set(handles.fuel_slider,'Value',1);
    guidata(hObject,handles);