• Matlab GUI工具栏编辑器


    1.滑块

    功能:采用GUI滑块进行图像的像素处理操作

    在滑块中添加的的代码:

    im=imread('cameraman.tif');
    axes(handles.axes2);
    imshow(im);
    k=get(hObject,'value');
    imshow(k.*im);
    

    2.单项选择按钮

     

    在第一个单项按钮下添加:

     

    set(handles.radiobutton1,'Value',1);
    set(handles.radiobutton2,'Value',0);   %设置20,即取消单选
    axes(handles.axes1);   %在坐标轴1画图
    mesh(peaks);
    

    在第二个单项按钮下添加:

    set(handles.radiobutton1,'Value',0);
    set(handles.radiobutton2,'Value',1);
    axes(handles.axes1);
    peaks;
    

    4.可编辑文本框

    写文本框中:

    set(handles.edit1,'string',i); 
    

    读取文本框中的内容:

    num = str2num(get(handles.eidt2,'string'));
    

    5.弹出式菜单

    弹出式菜单就是一个下拉菜单,具体的属性读取程序为:get(handles.popupmenul,'Value');对于下拉菜单的使用,采用switch case等程序结构。
    设计如下:

    popup_sel_index = get(handles.popupmenu1,'Value');
    switch popup_sel_index
        case 2
            axes(handles.axes1);
            t=1:10;
            y=t+1;
            plot(y,'linewidth','2');
        case 3
            axes(handles.axes1);
            t=1:10;
            y=t.^2+1;
            plot(y,'linewidth','2');
    end
    

    6.列表框

    列表框将用户选择的信息呈现出来,用户在列表框中选择文本,针对不同的选择结果,执行不同的功能。
    获取列表框的字符串:

    list_entries=get(handles.listbox2,'String');  %获取列表框字符串
    index_selected=get(handles.listbox2,'Value'); %获取列表框值
    

    7.切换按钮

    切换按钮属性值为up何down两个。单击一下切换按钮,输出为up,再次单击输出为down。

    button_state = get(hObject,'Value');
    if button_state == get(hObject,'Max')    %单击
        display('down');
    elseif button_state==get(hObject,'Min')  %再次单击
        display('up');
    end
    if button_state==0          %再次单击
        axes(handles.axes1);
        imshow(imread('cameraman.tif'));
    elseif button_state==1      %单击
         axes(handles.axes1);
         peaks;
    end
    

    8.表

    见帮助文档:

    doc uitable
    

    9.面板

    GUI面板将某些模块的功能按键放在一起,实现整分块的结构设计。移动面板时,面板上的功能按钮和面板一起移动,并且相对位置和相对大小不会改变。

    10.GUI ActiveX控件

    开始Matlab是64位的没有 LED Control Activex控件,最后Matlab直接换成32位的了,心痛!(不过好像matlab2015版本以后不再支持32位了。)
    可以参考:

    http://www.cnblogs.com/qiufenghui/p/3453083.html

  • 相关阅读:
    Java调用本地接口:java.lang.UnsatisfiedLinkError
    httpSession
    <mvc:annotation-driven>和DefaultAnnotationHandlerMapping 配置教训
    Spring 中的HiddenHttpMethodFilter类
    Myeclipse Jquery代码提示
    修改MyEclipse8.5的默认工作空间
    React 实战系列:模块化
    兼容性 memo
    破解 JS(原型)继承
    CSS Basic Memo
  • 原文地址:https://www.cnblogs.com/boyiliushui/p/7795641.html
Copyright © 2020-2023  润新知