I'm new with GUIDE and would like to know what the difference between setappdata() and set().
For example I have a variable handles.response = 0, when a push button is pressed I would like the value to change to 5. So in the push button callback I write:
function G_Callback(hObject, eventdata, handles)% hObject handle to G (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
G=5;set (handles.response,'String',G);guidata(hObject,handles);
Is it the same with setappdata if I write:
function G_Callback(hObject, eventdata, handles)% hObject handle to G (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)G=5;setappdata (0,'handles.response',G);guidata(hObject,handles);
Thank you.
Best Answer