zoukankan      html  css  js  c++  java
  • matlab GUI 编程

    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,并赋字符串值
  • 相关阅读:
    让你的python程序同时兼容python2和python3
    Python3.x 和Python2.x 区别
    python类型转换、数值操作(收藏)
    Python IDLE快捷键一览
    Python数据类型详解
    sublime text3安装SublimeREPL--解决不能运行input()的问题
    C语言(六)语句
    C语言(五)数学函数
    C语言(四)隐式类型转换规则
    C语言(三)关键字
  • 原文地址:https://www.cnblogs.com/mtcnn/p/9422752.html
Copyright © 2011-2022 走看看