matlab GUI 编程
2024-09-29 22:32:00
matlab 语法的简便,在 GUI 上也不遑多让呀;
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,并赋字符串值
最新文章
- java语句类型
- 【转】Spring+Hibernate+EHcache配置(一)
- 微信小程序开发工具 常用快捷键
- oracle存储过程的创建和使用
- C#基础(二)--之数据类型
- 201621123043 《Java程序设计》第1周学习总结
- C#实现MD5算法
- css中bfc和ifc
- 总结JAVA----IO流中的File类
- 基于335X平台的UBOOT中交换芯片驱动移植
- Yarn常用命令总结
- Nginx自动安装脚本
- 斯特林公式 ——Stirling公式(取N阶乘近似值)(转)
- Windows10 64位下安装TensorFlow谷歌人工智能系统已官方原生支持
- django之python网站开发基础
- oAuth2.0及jwt介绍
- linux 下crontab相关定时触发的配置规则
- hdu 4240 最大流量路径
- Python Twisted系列教程4:由Twisted支持的诗歌客户端
- Spring 中bean的作用、定义
热门文章
- 剪枝法观点下的旅行商问题(TSP)
- linux下如何获取每个线程的CPU占用率
- 数据类型总结——null和undefined
- pandas 学习(四)—— 数据处理(清洗)、缺失值的处理
- [React Native] Animate Styles of a React Native View with Animated.timing
- Strut2与Hibernate的一个web分页功能
- ### Hibernate中的事务与并发 ###
- PatentTips - Well bias control circuit
- PHP移动互联网开发笔记(8)——MySQL数据库基础回顾[2]
- PHP移动互联网开发笔记(7)——MySQL数据库基础回顾[1]