matlab GUI 编程
2016-11-17 17:24
387 查看
matlab 语法的简便,在 GUI 上也不遑多让呀;
uigetfile
Use the mouse to click and drag the desired rectangle(用鼠标拖拽获得期望的矩形区域). rect is a four-element vector with the form [xmin ymin width height](返回值是四个元素构成的一个vector). To constrain the rectangle to be a square, use a shift- or right-click to begin the drag.(想要限制这个矩形为一个正方形,使用shift或者单击右键开始拖拽)
uigetfile
[filename, pathname] = uigetfile('*.m', 'choose a m file')
1. 创建对话框程序
button = questdlg('qstring','title','str1','str2',default) % 第一个参数:显示的字符串 % 第二个参数:表示对话框的标题 % 后续可变参数表示,不同的按钮 % 最后一个字符串为默认选定的按钮,(需在前面已经出现) % 返回值为选中的按钮对应的文本类型
button = questdlg('qstring','title','str1','str2','str1')
2. 交互式获取矩形区域的坐标
>> rect = getrect % in current axes >> rect = getrect(fig) % in the current axes of figure fig >> rect = getrect(ax) % in the axes specified by the handle ax.
Use the mouse to click and drag the desired rectangle(用鼠标拖拽获得期望的矩形区域). rect is a four-element vector with the form [xmin ymin width height](返回值是四个元素构成的一个vector). To constrain the rectangle to be a square, use a shift- or right-click to begin the drag.(想要限制这个矩形为一个正方形,使用shift或者单击右键开始拖拽)
3. 输入框
prompt = {'Enter image name:', 'Enter colormap name:'}; title = 'Image display - assignin example'; lines = 1; def = {'my_image', 'hsv'}; answer = inputdlg(prompt, title, lines, def); % answer 接收输入框文本的值; assignin('base', 'imfile', answer{1}); assignin('base', 'cmap', answer{2}); % 在 base workspace 下创建两个变量,imfile,cmap,并赋字符串值
相关文章推荐
- Matlab------------GUI编程:gui程序设计与发布
- Matlab---GUI编程1
- Matlab------------GUI编程:mcc命令参数用法
- Matlab的GUI编程入门项目一:常用三角函数的绘制
- Matlab---GUI界面编程2(m文件纯代码实现)
- Matlab------------GUI编程:gui编程数据传递
- Matlab------------GUI编程:控制运算精度
- Matlab GUI 编程体验
- Matlab----GUI编程-登录框实现(纯m文件)
- MATLAB GUI编程入门
- MATLAB GUI编程开发小点
- 无GUI & 无Simulink·MATLAB基础编程•课后答案·《MATLAB程序设计与应用》•第二版•刘卫国
- matlab GUI界面编程总结
- Matlab------------Gui编程listbox
- matlab GUI界面编程总结
- Matlab------------GUI编程:gui中的变量传递
- MATLAB GUI编程中几个有用的程序段
- 学习matlab GUI编程的一点点所得
- matlab GUI界面编程总结
- Matlab------------GUI编程:运算editbox中的数学表达式