If I understand correctly, you have a toggle button and a pushbutton. When you set the toggle button to 'on', you want the pushbutton callback to execute. Is that correct?
If that is correct, the trick is perhaps to realize that your callbacks are just functions. You can call them just like any function. The solution here is to call the pushbutton callback from within the toggle callback function (when value is 'on'). Just be sure to set the first input to be the corresponding component object instead of hObject.
function on_offbutton_Callback(hObject, eventdata, handles)
button_state = get(hObject,'Value');
set(handles.on_offbutton,'String','ON','ForegroundColor','green')
add_Callback(handles.add_callback, eventdata, handles)
set(handles.on_offbutton,'string','OFF','foregroundcolor','red')
Best Answer