I have 3 sliders. When I move one of the sliders I want to get the summ of Sliders Values. But summing of the Sliders Value I want to realise in separate function.
function slider1_Callback(hObject, eventdata, handles)result;function slider2_Callback(hObject, eventdata, handles)result;function slider3_Callback(hObject, eventdata, handles)result;function result x=get(handles.slider1,'Value'); %position of X slider
set(handles.text1,'String', num2str(x)); y=get(handles.slider2,'Value'); %position of Y slider
set(handles.text2,'String', num2str(y)); z=get(handles.slider3,'Value'); %position of Z slider
set(handles.text3,'String', num2str(z)); result=x+y+z; set(handles.textResult,'String', num2str(result));
If I moves one of the slider (the 3rd for example):
??? Undefined variable "handles" or class"handles.slider1".Error in ==> subfunction>result at 167x=get(handles.slider1,'Value');%position of X sliderError in ==> subfunction>slider3_Callback at 151result;Error in ==> gui_mainfcn at 96 feval(varargin{:});Error in ==> subfunction at 42 gui_mainfcn(gui_State, varargin{:});Error in ==>@(hObject,eventdata)subfunction('slider3_Callback',hObject,eventdata,guidata(hObject))??? Error while evaluating uicontrol Callback
I try to add (hObject, eventdata, handles) to result function, but it doesn`t help. I`m not realy good in GUIDE functions, can someone help me, please?
Best Answer