菜单选择:
Opening函数:
openingFcn执行于窗口可见之前,这个时候你想做什么的话可以把代码写进去
function plott_OpeningFcn(hObject, eventdata, handles, varargin)
t=1/200:1/200:1;
plot(t,sin(2*pi*t*10),'r');
几个回调函数:
function Grid_off_Callback(hObject, eventdata, handles)
grid off;
function Grid_on_Callback(hObject, eventdata, handles)
grid on;
function About_Callback(hObject, eventdata, handles)
helpdlg('This is an example ','About')
function Close_Callback(hObject, eventdata, handles)
cla;%清除坐标轴
delete(handles.figure1);%关闭图形窗口
结果:(grid on不显示。。其他正常)
快捷菜单:
回调函数:
function Plot_Callback(hObject, eventdata, handles)
t=1/200:1/200:1;
plot(t,sin(2*pi*t*10),'r');% --------------------------------------------------------------------
function grid_on_Callback(hObject, eventdata, handles)
grid on;% --------------------------------------------------------------------
function grid_off_Callback(hObject, eventdata, handles)
grid off;% --------------------------------------------------------------------
function Clear_Callback(hObject, eventdata, handles)
cla;
效果: