matlab课件:用户界面设计2(精品)

上传人:仙*** 文档编号:244735563 上传时间:2024-10-05 格式:PPT 页数:30 大小:711KB
返回 下载 相关 举报
matlab课件:用户界面设计2(精品)_第1页
第1页 / 共30页
matlab课件:用户界面设计2(精品)_第2页
第2页 / 共30页
matlab课件:用户界面设计2(精品)_第3页
第3页 / 共30页
点击查看更多>>
资源描述
单击此处编辑母版标题样式,单击此处编辑母版文本样式,第二级,第三级,第四级,第五级,*,例,1,建立控件对象,当单击该,按钮,时绘制出正弦曲线。同时建立,双位按钮,,用于绘制是否给坐标加网格线。,建立,单选按钮,,用来设置图形窗口的颜色,只能选一种颜色。,1,2,3,function,pushbutton1_Callback,(hObject,eventdata,handles),t=0:pi/20:2*pi;,handles.current_data,=,plot(t,sin(t,);,axis(0 2*pi-1 1);,4,function,pushbutton2_Callback,(hObject,eventdata,handles),if(,get(hObject,Value)=1),grid on;,else,grid off;,end,5,function,radiobutton1_Callback,(hObject,eventdata,handles),%,hObject,handle to radiobutton1(see GCBO),%,eventdata,reserved-to be defined in a future version of MATLAB,%handles structure with handles and user data(see GUIDATA),h2=,findobj(gcf,String,white,);,set(h2,Value,0);,h3=,findobj(gcf,String,blue,);,set(h3,Value,0);,if (,get(hObject,Value,)=1),set(gcf,Color,r,);,end,6,function,radiobutton2_Callback,(hObject,eventdata,handles),%,hObject,handle to radiobutton2(see GCBO),%,eventdata,reserved-to be defined in a future version of MATLAB,%handles structure with handles and user data(see GUIDATA),h2=,findobj(gcf,String,red,);,set(h2,Value,0);,h3=,findobj(gcf,String,blue,);,set(h3,Value,0);,if(,get(hObject,Value,)=1),set(gcf,Color,w,);,end,7,function,radiobutton3_Callback,(hObject,eventdata,handles),%,hObject,handle to radiobutton3(see GCBO),%,eventdata,reserved-to be defined in a future version of MATLAB,%handles structure with handles and user data(see GUIDATA),h2=,findobj(gcf,String,red,);,set(h2,Value,0);,h3=,findobj(gcf,String,white,);,set(h3,Value,0);,if(,get(hObject,Value,)=1),set(gcf,Color,b,);,end,8,例,2,建立如图,8.10,所示的“数制转换”对话框。在左边输入一个十进制整数和,2,16,之间的数,单击“转换”按钮能在右边得到十进制对应的,2,16,进制字符串,单击“退出”按钮退出对话框。,pushbutton,edit,Frame,Text,9,10,function ex8p10_,OpeningFcn,(hObject,eventdata,handles,varargin,),%This function has no output,args,see,OutputFcn,.,%,hObject,handle to figure,%,eventdata,reserved-to be defined in a future version of MATLAB,%handles structure with handles and user data(see GUIDATA),%,varargin,command line arguments to ex8p10(see VARARGIN),global n b,11,function,edit1_Callback,(hObject,eventdata,handles),%,hObject,handle to edit1(see GCBO),%,eventdata,reserved-to be defined in a future version of MATLAB,%handles structure with handles and user data(see GUIDATA),global n,n=str2double(get(hObject,String);,12,function,edit2_Callback,(hObject,eventdata,handles),%,hObject,handle to edit2(see GCBO),%,eventdata,reserved-to be defined in a future version of MATLAB,%handles structure with handles and user data(see GUIDATA),global b,b=str2double(get(hObject,String);,%Hints:,get(hObject,String,)returns contents of edit2 as text,%str2double(get(hObject,String)returns contents of edit2 as a double,13,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),global n b,h=findobj(gcf,Tag,edit3);,dec,=,trdec(n,b);,set(h,String,dec,);,14,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),close(gcf,);,15,16,17,例,3,建立如图,8.11,所示的图形演示对话框。在文本框中输入绘图命令,当单击“绘图”按钮时,能在左边坐标轴所对应的图形,下拉列表框提供色图控制,列表框提供坐标网格线和坐标边框控制。,Popup button,edit,listbox,Axis,pushbutton,18,19,function,popupmenu1_Callback,(hObject,eventdata,handles),%,hObject,handle to popupmenu1(see GCBO),%,eventdata,reserved-to be defined in a future version of MATLAB,%handles structure with handles and user data(see GUIDATA),n1=,get(hObject,Value);,chpop,=,spring,summer,autumn,winter,;,colormap(eval(chpopn1);,20,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),21,function,edit1_Callback,(hObject,eventdata,handles),%,hObject,handle to edit1(see GCBO),%,eventdata,reserved-to be defined in a future version of MATLAB,%handles structure with handles and user data(see GUIDATA),hedit,=,get(hObject,String,);,eval(hedit,),22,function,listbox1_Callback,(hObject,eventdata,handles),%,hObject,handle to listbox1(see GCBO),%,eventdata,reserved-to be defined in a future version of MATLAB,%handles structure with handles and user data(see GUIDATA),n2=,get(hObject,Value);,chlist,=grid,on,grid,off,box,on,box,off;,eval(chlistn2);,23,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),close all;,24,25,26,27,28,29,30,
展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 管理文书 > 施工组织


copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!