在matlab命令行上输入guide或者从菜单中选择New GUI可以创建matlab的图形用户界面。
创建空白的GUI界面(默认),其界面如下:
未命名情况下matlab将会在当前工作目录下,同时将会生成untitled.fig和untitled.m文件。其中untitled.fig是图形用户界面文件,用于生成GUI界面,和用户进行交互,untitled.m是实现文件,用来处理用户的请求,函数实现在这里。
左边是工具箱,右边是画布,上面的工具栏是一些常用操作的快捷方式,例如撤销恢复,拷贝粘贴,对齐,对象浏览,运行。有过其他语言GUI编程的朋友应该不陌生。
再来看看matlab在untitled.m生成哪些内容。
function varargout = untitled(varargin)
% UNTITLED MATLAB code for untitled.fig
% UNTITLED, by itself, creates a new UNTITLED or raises the existing
% singleton*.
%
% H = UNTITLED returns the handle to a new UNTITLED or the handle to
% the existing singleton*.
%
% UNTITLED('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in UNTITLED.M wit