实验第九讲GUI功能

上传人:E**** 文档编号:90890644 上传时间:2019-06-19 格式:PPT 页数:24 大小:7.07MB
返回 下载 相关 举报
实验第九讲GUI功能_第1页
第1页 / 共24页
实验第九讲GUI功能_第2页
第2页 / 共24页
实验第九讲GUI功能_第3页
第3页 / 共24页
实验第九讲GUI功能_第4页
第4页 / 共24页
实验第九讲GUI功能_第5页
第5页 / 共24页
点击查看更多>>
资源描述

《实验第九讲GUI功能》由会员分享,可在线阅读,更多相关《实验第九讲GUI功能(24页珍藏版)》请在金锄头文库上搜索。

1、数学实验九 MATLAB图形用户界面( GUI),句柄图形操作 图形用户界面(GUI),句柄图形操作,基本概念 句柄图形(对底层图形例程集合的总 称,并生成图形) 对象(一组紧密相关,形成统一整体 的数据结构和函数的集合) 句柄(每一个对象的唯一数据标识),句柄图形对象,对象的属性:每一个对象都具有与特定对象 相应的特性,不同的对象的属性可由函数 Get获得,Set进行设置 对象属性包括:属性名和属性值 如:Hd=figure(color,white),H=figure Get(H) BackingStore = on CloseRequestFcn = closereq Color = 0.

2、8 0.8 0.8 Colormap = (64 by 3) double array CurrentAxes = CurrentCharacter = CurrentObject = CurrentPoint = 0 0 Dithermap = (64 by 3) double array DithermapMode = manual FixedColors = (3 by 3) double array IntegerHandle = on,例,InvertHardcopy = on KeyPressFcn = MenuBar = figure MinColormap = 64 Name

3、= NextPlot = add NumberTitle = on PaperUnits = inches,PaperOrientation = portrait PaperPosition = 0.25 2.5 8 6 PaperPositionMode = manual PaperSize = 8.5 11 PaperType = usletter Pointer = arrow PointerShapeCData = (16 by 16) double array PointerShapeHotSpot = 1 1,Position = 64 36 672 504 Renderer =

4、painters RendererMode = auto Resize = on ResizeFcn = SelectionType = normal ShareColors = on Units = pixels WindowButtonDownFcn = WindowButtonMotionFcn = WindowButtonUpFcn = WindowStyle = normal ButtonDownFcn = Children = Clipping = on,CreateFcn = DeleteFcn = BusyAction = queue HandleVisibility = on

5、 HitTest = on Interruptible = on Parent = 0 Selected = off SelectionHighlight = on Tag = Type = figure UIContextMenu = UserData = Visible = on,h=plot(x,y,x,z) 返回句柄h(1)和h(2) Set(h(1),color,1 0.3 0.5,linewidth,3) Set(h(2),color,1 0.5 0.5,linewidth,4),获得当前对象句柄(最常用对象) H1=gcf; get current figure(gcf for

6、short) H2=gca; get current axis (gca) H3=gco; get current object (gco) Get(H1,type) Get(H2,type) Get(0)根对象属性,获得当前所有对象句柄 H=Findobj Findobj(Property,PropertyValue),位置(position)和单位(units) Units:inches;centimeters,根对象的位置属性: Position由ScreenSize代替 left,bottom1,1 width,height屏幕实际尺寸 例:get(0,screensize) ans

7、= 1 1 800 600,图形句柄函数,创建图形用户界面(GUI) Graphics User Interface,GUI的层次结构,建立用户菜单和子菜单,hm1=uimenu(h_parent,property,propertyvalue) 最重要的属性 Label: 其属性值为菜单和下拉菜单的文本字符串 Callback:其属性值为Matlab字符串,当选中菜单项时,传给eval函数,并执行,如: H1=uimenu(gcf,label,example) H1_1=uimenu(H1,label,grid,callback,grid) H1_2=uimenu(H1,label,view

8、) H1_21=uimenu(H1_2,label,2-D,callback,view(2) H1_22=uimenu(H1_2,label,3-D,callback,view(3),控制框类型,按纽框:执行一个动作(如open, close) 无线按纽:设置参数的开关(0 或1) 检查框:切换按纽 静态文本框:显示标示用户信息及当前值 可编辑文本框:容许用户输入文本或特定值 滑标(滚动条):用于选取某一范围内的值 弹出式菜单:向用户提供一些可选的清单 框架:带色彩的矩形区域,提供视觉的分隔性,如: H_box=uicontrol(gcf,style,check, position,100 5

9、0 100 20, string,Axis Box, callback,if get(H_box,value)=1, set(gca,box,on), else set(gca,box,off), end),建立用户控制框,hm1=uicontrol(h_parent,style,stylevalue,property,propertyvalue) 最重要的属性 Style: 其属性值为控制框类型 Callback:其属性值为Matlab字符串,当选中该项时,传给eval函数,并执行相应的命令,创建用户GUI的Matlab工具,Guide函数的使用 各类对象的含义与定义方式 创建GUI的一个示例,详细情况请见MATLAB GUI 演示,

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 高等教育 > 大学课件

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号