Matlab GUI,坐标轴控件,画sin函数

来源:互联网 发布:淘宝天猫电器城 编辑:程序博客网 时间:2024/06/06 09:38

guide  (代码:1\gui_biancheng.m)

% 打开窗体钱先执行该函数function gui_biancheng_OpeningFcn(hObject, eventdata, handles, varargin)handles.output = hObject;handles.x=-pi:0.01:pi;  %全局变量guidata(hObject, handles);
sin按钮
function sin_Callback(hObject, eventdata, handles)x=handles.x;y=sin(x);plot(handles.plotaa,x,y);   %在坐标轴(plotaa)中画线
cos按钮

function cos_Callback(hObject, eventdata, handles)x=handles.x;y=cos(x);plot(handles.plotaa,x,y);  %在坐标轴(plotaa)中画线
clear按钮
function clear_Callback(hObject, eventdata, handles)try    delete(allchild(handles.plotaa));  %清空坐标轴,删除坐标轴的所有孩子结点end



原创粉丝点击