MATLAB: How can i get value of another function in gui

get gobject value functionguide

How can i get value of checkbox inside another fuction?
For example:
function checkbox1_Callback(hObject, eventdata, handles)
....
....
function checkbox2_Callback(hObject, eventdata, handles)
%here i need to check state of function checkbox1
thanks!!

Best Answer

Simply use the get() function:
function checkbox2_Callback(hObject, eventdata, handles)
% Get the check state of checkbox1
checkbox1Value = get(handles.checkbox1, 'value');
% Now also get the check state of checkbox2
checkbox2Value = get(handles.checkbox2, 'value');