1つのボタンを押して値を設定し、別のボタンを押して変数の値を出力したいと思います。次のコードを使用して最初にボタンを押しても値が設定されていないようです。何故ですか?
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
handles.dog=1001
% --- Executes on button press in pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
handles
disp(num2str(handles.dog)) % <-- value not present