绘图按钮:
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
X=1;
handles.X=X;
guidata(hObject,handles)
axes(handles.axes1)
f= str2double(get(handles.edit1,'String'));
w=2*pi*f;
t=0:0.001:1;
plot(t,sin(w*t))
传递按钮:
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)
set(handles.text2,'String',num2str(handles.X))